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

Reply
 
Thread Tools Display Modes
  #11  
Old 08-15-2007, 06:32 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think that method will query the database for each user on the page.

Try this ;

Create a plugin using the "online_query" hook - with this in it ;

Code:
$hook_query_fields .= ' , userfield.* ';
You should then have the userfields in the $userinfo array ( e.g. $userinfo['field6'] );
Reply With Quote
  #12  
Old 10-08-2007, 12:12 PM
Pottsy Pottsy is offline
 
Join Date: Sep 2006
Location: UK
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
I think that method will query the database for each user on the page.
It does. :down:

Quote:
Originally Posted by Paul M View Post
e.g. $userinfo['field6'] );
Paul - can't get yours to work, but this is not helped by me not understanding your method exactly! One thing is I can't enter the single quotes you use (around field6). And it seems to only affect the WOL page, which just returns a database error.

Any advances?
Reply With Quote
  #13  
Old 10-08-2007, 01:19 PM
WhaLberg's Avatar
WhaLberg WhaLberg is offline
 
Join Date: Nov 2006
Location: Dersaadet
Posts: 569
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please note that do not use ' (single quote) in templates.
Reply With Quote
  #14  
Old 10-08-2007, 04:15 PM
Pottsy Pottsy is offline
 
Join Date: Sep 2006
Location: UK
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Indeed not.

I suspect the solution is to add a bit to the query in index.php, but I'm not having much luck so far.
Reply With Quote
  #15  
Old 10-08-2007, 05:21 PM
Michael Biddle Michael Biddle is offline
 
Join Date: Apr 2004
Location: Anaheim, CA
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Pottsy View Post
Paul - can't get yours to work, but this is not helped by me not understanding your method exactly! One thing is I can't enter the single quotes you use (around field6). And it seems to only affect the WOL page, which just returns a database error.

Any advances?
Paul is right. The hook is already inside of the query so you are just adding more things for it to select out of the database for instance, fielf6.

In your template you should then use $userinfo[field6]
Reply With Quote
  #16  
Old 10-08-2007, 05:38 PM
Pottsy Pottsy is offline
 
Join Date: Sep 2006
Location: UK
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by whitemike View Post
Paul is right. The hook is already inside of the query so you are just adding more things for it to select out of the database for instance, fielf6.

In your template you should then use $userinfo[field6]
If I reproduce what Paul suggests, then using $userinfo[field6] in the template forumhome_loggedinuser has no effect (what we're trying to do is get stuff to show in the list of users in "What's going on".

Furthermore, the WOL page (online.php, which we are not trying to modify) shows:


Code:
Database error in vBulletin 3.6.8:

Invalid SQL:

	SELECT user.username, session.useragent, session.location, session.lastactivity, user.userid, user.options, session.host, session.badlocation, session.incalendar, user.aim, user.icq, user.msn, user.yahoo, user.skype,
	IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
	 , userfield.* 
	FROM session AS session
	 LEFT JOIN user AS user USING (userid) 
	
	WHERE session.lastactivity > 1191867322
		
		
	ORDER BY user.username asc;

MySQL Error  : Unknown table 'userfield'
Error Number : 1051
Date         : Monday, October 8th 2007 @ 07:30:22 PM
Script       : http://localhost/forum/online.php
Referrer     : http://localhost/forum/index.php
IP Address   : 127.0.0.1
Username     : Pottsy
Classname    : vB_Database
--------------- Added at 10:26 ---------------

I now have this working, but it would be great if an SQL person could check my code for me.

In index.php, there is the query in "logged in users" that pulls the stuff up for WGO. I have added the stuff in red:

Code:
$forumusers = $db->query_read_slave("
        SELECT
            user.username, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible,  user.usergroupid,
            session.userid, session.inforum, session.lastactivity, userfield.field6, userfield.userid,
            IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
        FROM " . TABLE_PREFIX . "session AS session
        LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)
        LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(user.userid = userfield.userid)
        WHERE session.lastactivity > $datecut

I have also added the line in red just below:

Code:
'invisible'         =>& $vbulletin->userinfo['invisible'],
'field6'         =>& $vbulletin->userinfo['field6'],


And I can now use $loggedin[field6] in forumhome_loggedinuser. I know this is poor because it modifies php, but in the absence of a hook in that query I can't see another way.
Reply With Quote
  #17  
Old 10-09-2007, 05:25 PM
Michael Biddle Michael Biddle is offline
 
Join Date: Apr 2004
Location: Anaheim, CA
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Request a hook location at vb.com
Reply With Quote
  #18  
Old 10-09-2007, 05:56 PM
Pottsy Pottsy is offline
 
Join Date: Sep 2006
Location: UK
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As I see it, it would require three...
Reply With Quote
  #19  
Old 10-09-2007, 07:41 PM
Michael Biddle Michael Biddle is offline
 
Join Date: Apr 2004
Location: Anaheim, CA
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

request 3 then.
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 07:57 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03944 seconds
  • Memory Usage 2,249KB
  • Queries Executed 13 (?)
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
  • (4)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete