Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2014, 09:15 PM
D3m0n h311ra153's Avatar
D3m0n h311ra153 D3m0n h311ra153 is offline
 
Join Date: Sep 2012
Location: Newcastle / UK
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Online status in memberlist

Like the Title suggests.

I have added it so far into the memberlist template like so:-
Code:
<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
Reply With Quote
  #2  
Old 11-19-2014, 09:18 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It may be because the last vb:elseif should be vb:else
Reply With Quote
  #3  
Old 11-19-2014, 09:22 PM
D3m0n h311ra153's Avatar
D3m0n h311ra153 D3m0n h311ra153 is offline
 
Join Date: Sep 2012
Location: Newcastle / UK
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 11-19-2014, 09:45 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I haven't tried it, but you might try this: Create a plugin using hook location memberlist_bit and code like this:
Code:
$memberlist['onlinestatus'] = fetch_online_status($memberlist);
Then in the template condition, check $userinfo['onlinestatus'] instead of $onlinestatus.
Reply With Quote
  #5  
Old 11-19-2014, 09:55 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am trying that Kevin, but it is not working ATM, still looking into it.
Reply With Quote
  #6  
Old 11-19-2014, 09:58 PM
D3m0n h311ra153's Avatar
D3m0n h311ra153 D3m0n h311ra153 is offline
 
Join Date: Sep 2012
Location: Newcastle / UK
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get this error when viewing the memberlist

Quote:
Fatal error: Call to undefined function fetch_online_status() in memberlist.php(884) : eval()'d code on line 5
Reply With Quote
  #7  
Old 11-19-2014, 10:03 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's because you need to add this above that.

PHP Code:
require_once(DIR '/includes/functions_bigthree.php'); 
Reply With Quote
Благодарность от:
kh99
  #8  
Old 11-19-2014, 10:12 PM
D3m0n h311ra153's Avatar
D3m0n h311ra153 D3m0n h311ra153 is offline
 
Join Date: Sep 2012
Location: Newcastle / UK
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks ozzy47 & kh99 :up:

This did exactly what I wanted, despite my 6hrs of trying.
Reply With Quote
  #9  
Old 11-19-2014, 10:13 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent, glad to hear it worked for you.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:50 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04528 seconds
  • Memory Usage 2,244KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (1)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete