ElkArte Community

Project Support => Support => Topic started by: Mrs. Chaos on May 07, 2018, 07:38:10 am

Title: Changing the order of the "online now" display
Post by: Mrs. Chaos on May 07, 2018, 07:38:10 am
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.
Title: Re: Changing the order of the "online now" display
Post by: Spuds on May 07, 2018, 08:29:05 am
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.
Title: Re: Changing the order of the "online now" display
Post by: Mrs. Chaos on May 07, 2018, 10:44:28 am
Thank you, it's perfect now! :)
Title: Re: Changing the order of the "online now" display
Post by: Mrs. Chaos on May 07, 2018, 03:50:43 pm
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
Title: Re: Changing the order of the "online now" display
Post by: Spuds on May 07, 2018, 04:01:18 pm
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.
Title: Re: Changing the order of the "online now" display
Post by: Mrs. Chaos on May 07, 2018, 04:08:30 pm
Okay, here it is.
Title: Re: Changing the order of the "online now" display
Post by: Spuds on May 07, 2018, 04:24:40 pm
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.

 
Title: Re: Changing the order of the "online now" display
Post by: Mrs. Chaos on May 07, 2018, 04:51:23 pm
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!