PDA

View Full Version : Online status in memberlist


D3m0n h311ra153
11-19-2014, 09:15 PM
Like the Title suggests.

I have added it so far into the memberlist template like so:-
<vb:if condition="$onlinestatus==0">
<img class="inlineimg onlinestatus" src="{vb:stylevar imgdir_statusicon}/user-offline_memberlist.png" alt="{vb:rawphrase x_is_offline, {vb:raw userinfo.username}}" border="0" />
<vb:elseif condition="$onlinestatus==1" />
<img class="inlineimg onlinestatus" src="{vb:stylevar imgdir_statusicon}/user-online_memberlist.png" alt="{vb:rawphrase x_is_online_now, {vb:raw userinfo.username}}" border="0" />
<vb:elseif condition="$onlinestatus==2" />
<img class="inlineimg onlinestatus" src="{vb:stylevar imgdir_statusicon}/user-invisible_memberlist.png" alt="{vb:rawphrase x_is_invisible, {vb:raw userinfo.username}}" border="0" />
</vb:if>

The "user-offline/online/invisible_memberlist.png" is a custom image to fit the size of the username height, so ignore the name change from the original.

Now, no matter what I do, the code only outputs the very first vb:if, and from what I have so far gathered, the $onlinestatus variable is not global and cannot be used in the memberlist template.

Is there a way of making this available, or a hook to pull the correct info, I am at my wits end to get this to work.

Remember, I am not a coder ;)

ozzy47
11-19-2014, 09:18 PM
It may be because the last vb:elseif should be vb:else

D3m0n h311ra153
11-19-2014, 09:22 PM
Nah!

Didn't make a difference ozzy47, I have reworked this code a handful of times, using slightly different methods (which is probably why I made the mistake), but none of them will display anything other than the first vb:if, which is offline.

Thanks anyway

kh99
11-19-2014, 09:45 PM
I haven't tried it, but you might try this: Create a plugin using hook location memberlist_bit and code like this:
$memberlist['onlinestatus'] = fetch_online_status($memberlist);

Then in the template condition, check $userinfo['onlinestatus'] instead of $onlinestatus.

ozzy47
11-19-2014, 09:55 PM
I am trying that Kevin, but it is not working ATM, still looking into it.

D3m0n h311ra153
11-19-2014, 09:58 PM
I get this error when viewing the memberlist

Fatal error: Call to undefined function fetch_online_status() in memberlist.php(884) : eval()'d code on line 5

ozzy47
11-19-2014, 10:03 PM
That's because you need to add this above that.

require_once(DIR . '/includes/functions_bigthree.php');

D3m0n h311ra153
11-19-2014, 10:12 PM
Thanks ozzy47 & kh99 :up:

This did exactly what I wanted, despite my 6hrs of trying.

ozzy47
11-19-2014, 10:13 PM
Excellent, glad to hear it worked for you. :)