vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Where do I put this HOOK location so it works (https://vborg.vbsupport.ru/showthread.php?t=201885)

mcyates 01-15-2009 03:48 PM

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


Lynne 01-15-2009 03:59 PM

Quote:

Originally Posted by mcyates (Post 1713518)

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?

Bellardia 01-15-2009 04:52 PM

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.

mcyates 01-15-2009 09:51 PM

Quote:

Originally Posted by Lynne (Post 1713533)
PHP Code:

WHERE user.usergroupid IN ($group

where is $group defined?

Quote:

Originally Posted by Bellardia (Post 1713591)
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.

Bellardia 01-16-2009 03:14 AM

Where did you get it from than ;)
Ask the maker of the code to ask why he did what.

Dismounted 01-16-2009 04:50 AM

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.


All times are GMT. The time now is 03:26 AM.

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.02905 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete