Skip to main content
Topic: Changing the order of the "online now" display (Read 1760 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Changing the order of the "online now" display

Hello,
how can I change this order

Online now:  5 guests, 3 members (2 spiders)

into

Online now:  3 members, 5 guests (2 spiders)

because spiders are guests and in the first line it looks like they belong to the members.
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0

Re: Changing the order of the "online now" display

Reply #1

You need to edit BoardIndex.template.php (in the default theme directory) and find the below line and replace it with the new one.

Code: (find at line 326) [Select]
					', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];

Code: (replace with) [Select]
					', comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'], ', ', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'];

I actually think we should do this by default, not starting the list with members seems to prioritize guests over them.

Re: Changing the order of the "online now" display

Reply #2

Thank you, it's perfect now! :)
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0

Re: Changing the order of the "online now" display

Reply #3

I have a lot of this error message since I changed it. What's wrong threre?

41b77dd74cazY08XO0M8gWHqneQPSexb
Type of error: Undefined
Notice: Use of undefined constant guests - assumed 'guests'

BoardIndex.template.php
lines 101 and 105
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0

Re: Changing the order of the "online now" display

Reply #4

please post your BoardIndex.template.php  file so I can take a look.  Normally that error would indicate the word guests was left unquoted ... it should be 'guests', but the line numbers don't make any sense when looking at the default template.

Re: Changing the order of the "online now" display

Reply #5

Okay, here it is.

Re: Changing the order of the "online now" display

Reply #6

Line 101
Code: [Select]
	if ($settings['show_mark_read'] && !$context['user']['is_guest'][guests] && !empty($context['categories']))
See that unquoted [guests] thingy?   Same thing on line 105 .... those, if they were valid, should be quoted, but they are not valid and should be removed..  Looks like you were trying to make some other edit.   I've attached the fixed file.

 

Re: Changing the order of the "online now" display

Reply #7

I had made a few changes, also because of the adaptation of the addon "Users Online Today". But now everything still looks like before and the error messages are gone.
Thank you!
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0