Go Back   vBulletin Setup > vBulletinSetup Information > vBulletin Questions



Please Register to get full access to the forums.
Reply
 
LinkBack Thread Tools Display Modes



#1   11-11-2007, 03:17 PM
jackni will become famous soon enough Join Date: Oct 2007
iTrader: (0)
sql and plugin


how do i show the rep in the navigation bar?
i added to navbar template this

Reputation: $reputation

and i made this plugin

$query = "SELECT reputation FROM" . TABLE_PREFIX . "WHERE userid=" . $bbuserinfo[userid] . );
$reputation .= mysql_query($query);

but on the site it only says "Reputation: " and blank.
my plugin is hooked on navbits, did i get the right location? or did i mess up the sql thx
Quote   |  



#2   11-11-2007, 04:42 PM
Michael Biddle is just really niceMichael Biddle is just really nice Join Date: Aug 2006 Location: Anaheim, CA
iTrader: (0)
Re: sql and plugin


try using $vbulletin->db->query_read rather then mysql_query
--------------------
Do NOT PM me for Support!
Michael Biddle / vBulletin Setup Staff
Check out our Newsletter for the latest vB and SEO news.
Are you looking for vBulletin work to be done on your forums ?
Would you like to Help Support vBulletin Setup.
Quote   |  



#3   11-11-2007, 05:51 PM
jackni will become famous soon enough Join Date: Oct 2007
iTrader: (0)
Re: sql and plugin


it still doesn't work, should the hook be on navbits or something else?
Quote   |  



#4   11-11-2007, 06:21 PM
Michael Biddle is just really niceMichael Biddle is just really nice Join Date: Aug 2006 Location: Anaheim, CA
iTrader: (0)
Re: sql and plugin


Now that I look at it, it looks like you left table out. Try:

$reputation = $vbulletin->db->query_read("
SELECT reputation
FROM" . TABLE_PREFIX . "user
WHERE userid=" . $bbuserinfo['userid']
);
--------------------
Do NOT PM me for Support!
Michael Biddle / vBulletin Setup Staff
Check out our Newsletter for the latest vB and SEO news.
Are you looking for vBulletin work to be done on your forums ?
Would you like to Help Support vBulletin Setup.
Quote   |  



#5   11-11-2007, 07:03 PM
jackni will become famous soon enough Join Date: Oct 2007
iTrader: (0)
Re: sql and plugin


it still doesn't work, where should the hook location be?
Quote   |  



#6   11-11-2007, 07:04 PM
Michael Biddle is just really niceMichael Biddle is just really nice Join Date: Aug 2006 Location: Anaheim, CA
iTrader: (0)
Re: sql and plugin


I am not sure, I have not used any hook in the navbits before.
--------------------
Do NOT PM me for Support!
Michael Biddle / vBulletin Setup Staff
Check out our Newsletter for the latest vB and SEO news.
Are you looking for vBulletin work to be done on your forums ?
Would you like to Help Support vBulletin Setup.
Quote   |  



#7   11-11-2007, 07:24 PM
Michael Biddle is just really niceMichael Biddle is just really nice Join Date: Aug 2006 Location: Anaheim, CA
iTrader: (0)
Re: sql and plugin


Ok I got it. Put this in a plugin at global_start:

// Globalize Variables
global $vbulletin;

// Query It!
$reputation = $vbulletin->db->query_first("
SELECT reputation
FROM " . TABLE_PREFIX . "user
WHERE userid = '" . $vbulletin->userinfo['userid'] . "'
");


// Use $reputation[reputation] in your templates.

And use this in your template:

$reputation[reputation]
--------------------
Do NOT PM me for Support!
Michael Biddle / vBulletin Setup Staff
Check out our Newsletter for the latest vB and SEO news.
Are you looking for vBulletin work to be done on your forums ?
Would you like to Help Support vBulletin Setup.
Quote   |  



#8   11-11-2007, 07:36 PM
jackni will become famous soon enough Join Date: Oct 2007
iTrader: (0)
Re: sql and plugin


thanks it works, but can you tell me what -> means, how query_first differs from query_read and why use $reputation[reputation] instead just $reputation?
Quote   |  



#9   11-11-2007, 07:45 PM
Michael Biddle is just really niceMichael Biddle is just really nice Join Date: Aug 2006 Location: Anaheim, CA
iTrader: (0)
Re: sql and plugin


I use -> because it has to do with vbulletin operations. query_read is more for more then 1 field being pulled. and I use it like that because it is a query_first
--------------------
Do NOT PM me for Support!
Michael Biddle / vBulletin Setup Staff
Check out our Newsletter for the latest vB and SEO news.
Are you looking for vBulletin work to be done on your forums ?
Would you like to Help Support vBulletin Setup.
Quote   |  



#10   11-11-2007, 07:46 PM
jackni will become famous soon enough Join Date: Oct 2007
iTrader: (0)
Re: sql and plugin


thankssss
Quote   |  
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for vBulletin OpenID Plugin growgirl Webscripts and Websites 6 12-04-2007 02:44 PM
plugin hook location anuvenkatesh vBulletin Questions 0 11-16-2007 05:15 PM
WordPress Top Commenters Plugin / Widget Brandon Blogging Forum 0 08-13-2007 08:55 PM
[Code/Plugin] Zoints Local - Enhanced profiles, blogs, personal homepages, and more DChapman vBulletin Questions 1 11-29-2006 01:02 AM


All times are GMT -6. The time now is 07:39 PM.

vBulletin Setup, vBulletin Setup Forums, vBulletin Services, vBulletin Blogs, vBulletin SEO, vBulletin Questions
vBulletin Skins, Styles, Templates, vBulletin Monetization, Blogs, vBulletin Link Directory,Quality Link Directory