PDA

View Full Version : Where do I put this HOOK location so it works


mcyates
01-15-2009, 03:48 PM
I'm using this Side Bar (https://vborg.vbsupport.ru/showthread.php?t=117989) 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.


// @@@@@@@ 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 1232041991 at 1232041991 ---------------

I get this error when:

Product is: Right Side Column
Hook Location is: global_start

Obviously that is wrong lol

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
I get this error when:

Product is: Right Side Column
Hook Location is: global_start

Obviously that is wrong lol

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

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
WHERE user.usergroupid IN ($group)
where is $group defined?

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.