• If you are having any problems posting threads plz message Kate. since latest update we have had 6 members with problems, sorted those but yet to find the problem.

Xenforo Online Users List Modifications

Status
Not open for further replies.

Richard Forum IT

Richard IT
Altering/Adding colours (classes) to online members list talkinsex.com (xenforo 2.x)
Edit
Appearance -> Templates [style:talkinsex_2019] -> widget_members_online
locate line starting with
Code:
<xf:username user="$user"
add/alter the statements within class="" attribute
eg.
add
Code:
{{ $user.isMemberOf(107) ? 'user--talking-turkey' : '' }}
to add user--talking-turkey class if user is in the group talking turkey (group_id == 107)
find group_id in Groups & Permissions->User Groups and hover over the group and check the link which contains the group_id.
add/alter the class and values in
Appearance -> Templates [style:talkinsex_2019] -> extra.less
either find the class you want to alter or add the class you have created.
eg.
add
Code:
.user--talking-turkey {
  color:darkgreen;
}

NOTE: not too sure if the xenforo syntax in xf:username handles if, then, else. So this method will just add classes and they may fight each other for precedence.

Current:
Code:
{{ !$user.visible ? 'username--invisible' : '' }}{{ $user.isMemberOf(107) ? ' user--talking-turkey' : ''}}{{ $user.Profile.custom_fields.gender == 'male' ? ' user--male' : '' }}{{ $user.Profile.custom_fields.gender == 'female' ? ' user--female' : '' }}{{ $user.Profile.custom_fields.gender == 'Couple' ? ' user--couple' : '' }}{{ $user.Profile.custom_fields.gender == 'transsexual' ? ' user--transsexual' : '' }}

Obviously it would be better like this.
Code:
$class = '';
if (!$user.visible)
{
  $class = 'username--invisible';
}
elseif ($user.isMemberOf(107))
{
  $class = 'user--talking-turkey';
}
else
{
  switch ($user.Profile_custom_fields.gender)
  {
    case 'male':
      $class='user--male';
      break;
    case 'female':
      $class='user--female';
      break;
    case 'Couple':
      $class='user--couple';
      break;
    case 'transsexual':
      $class='user--transsexual';
      break;
  }
}
echo $class;

May need to read the xenforo programming documentation to get this far, backwards working forwards, if there are issues.
 
Last edited:
  • Haha
Reactions: mjj
Status
Not open for further replies.
Back
Top