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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2009, 03:48 PM
mcyates mcyates is offline
 
Join Date: Jan 2003
Location: Middlesbrough, Cleveland
Posts: 798
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Where do I put this HOOK location so it works

I'm using this Side Bar modification and that is where I want the data to be shown. I used to have Ultimate Side Columns and it worked on there but i've forgotten what hook location to use.

This is my code I'm using which shows only the current staff members who are actively on my forum. But I don't know where the hook should be called from.


Code:
// @@@@@@@ Lets See who is on @@@@@@@


$datecut = TIMENOW - $vbulletin->options['cookietimeout'];

$ForumUsers = $db->query_read("
SELECT user.username, session.userid, user.usergroupid
FROM " . TABLE_PREFIX . "session AS session
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)
WHERE user.usergroupid IN ($group) and session.lastactivity > $datecut
ORDER BY user.username ASC
");

$StaffOnline = "<!-- Staff Online -->
<div>";

if ( $db->num_rows( $ForumUsers ) )
{ $AddedStaff = array();
while ( $LoopUser = $db->fetch_array( $ForumUsers ) ) // Loop through current users
{
if ( !in_array( $LoopUser['userid'], $AddedStaff ) )
{
// Get Username with HTML markup
$LoopUser['musername'] = fetch_musername( $LoopUser );
$StaffOnline .= "<div><a href='member.php?u=".$LoopUser['userid']."'>".$LoopUser['musername']."</a></div>";
$AddedStaff[] = $LoopUser['userid'];
} // End if in_array()
} // End While
} // End if we have rows

// Check to see if there was staff and if not show message if config to do so.
if ( count( $AddedStaff ) == 0 OR !isset( $AddedStaff ) )
{
if ( $ShowNoStaffNotice ) { $StaffOnline .= "<div>No Staff Currently Browsing the Forums.</div>"; }
}

$StaffOnline .= "</div>
<!-- End Staff Online -->";
Thank In advance for any help.

--------------- Added [DATE]1232041991[/DATE] at [TIME]1232041991[/TIME] ---------------

I get this error when:

Product is: Right Side Column
Hook Location is: global_start

Obviously that is wrong lol

Code:
Database error in vBulletin 3.8.0:

Invalid SQL:

SELECT user.username, session.userid, user.usergroupid
FROM session AS session
LEFT JOIN user AS user ON(user.userid = session.userid)
WHERE user.usergroupid IN () and session.lastactivity > 1232041543
ORDER BY user.username ASC;

MySQL Error   : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and session.lastactivity > 1232041543
ORDER BY user.username ASC' at line 4
Error Number  : 1064
Request Date  : Thursday, January 15th 2009 @ 05:50:43 PM
Error Date    : Thursday, January 15th 2009 @ 05:50:43 PM
Script        : http://www.myfootballforum.com/index.php
Referrer      : http://www.myfootballforum.com/index.php
IP Address    : 86.22.39.14
Username      : boro_boy
Classname     : vB_Database
MySQL Version : 5.0.27
Reply With Quote
  #2  
Old 01-15-2009, 03:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mcyates View Post

I get this error when:

Product is: Right Side Column
Hook Location is: global_start

Obviously that is wrong lol

Code:
Database error in vBulletin 3.8.0:

Invalid SQL:

SELECT user.username, session.userid, user.usergroupid
FROM session AS session
LEFT JOIN user AS user ON(user.userid = session.userid)
WHERE user.usergroupid IN () and session.lastactivity > 1232041543
ORDER BY user.username ASC;

MySQL Error   : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and session.lastactivity > 1232041543
ORDER BY user.username ASC' at line 4
Error Number  : 1064
Request Date  : Thursday, January 15th 2009 @ 05:50:43 PM
Error Date    : Thursday, January 15th 2009 @ 05:50:43 PM
Script        : http://www.myfootballforum.com/index.php
Referrer      : http://www.myfootballforum.com/index.php
IP Address    : 86.22.39.14
Username      : boro_boy
Classname     : vB_Database
MySQL Version : 5.0.27
PHP Code:
WHERE user.usergroupid IN ($group
where is $group defined?
Reply With Quote
  #3  
Old 01-15-2009, 04:52 PM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Problem seems to be with your SQL queries and not where your plugin is located.
As Lynne pointed out you call $group but it doesn't seem to be defined anyways, I doubt it was stored globally, but I'm not sure.
Reply With Quote
  #4  
Old 01-15-2009, 09:51 PM
mcyates mcyates is offline
 
Join Date: Jan 2003
Location: Middlesbrough, Cleveland
Posts: 798
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
PHP Code:
WHERE user.usergroupid IN ($group
where is $group defined?
Quote:
Originally Posted by Bellardia View Post
Problem seems to be with your SQL queries and not where your plugin is located.
As Lynne pointed out you call $group but it doesn't seem to be defined anyways, I doubt it was stored globally, but I'm not sure.
I don't even know what that code means!!

It worked when i put it on the Ultimate Site Columns, but doesn' work now. Hmm, i'm a begineerin with the ocde stuff, don't know anything lol.

I might just have to remove it all. The only think is its usefull if the staff who are online are shown, but i guess they can be shown and are show in the whos online bit.
Reply With Quote
  #5  
Old 01-16-2009, 03:14 AM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where did you get it from than
Ask the maker of the code to ask why he did what.
Reply With Quote
  #6  
Old 01-16-2009, 04:50 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is just a WOL except showing staff only (well meant to, anyway). As you have said, the WOL could possibly be "moulded" to do what you want.
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 06:10 PM.


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.07328 seconds
  • Memory Usage 2,227KB
  • 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
  • (3)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete