Show Site Donators Icon In Forums

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Show Site Donators Icon In Forums
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
Hey guys,

I searched the forums for the answer to this question, but didn't find an answer. So I apologize if I missed it.

I'm using Telli's killer donate mod and would like to show an icon near the user's avatar in the forums if they're a donator (very similar to how it's listed here). I think I've got the sql query down right, but I'm not sure what files I need to edit to get it to work.


Here's the code I've written so far, just not sure what to do with it...I could be WAY off:

global $db, $prefix, $user, $userinfo;
$user_id = intval($user_id);

$donator = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_donators WHERE donshow = 1 AND uid = $user_id"));

if ($donator > 0) {
   $site_donator = "GV Site Donator!";
   } else {
   $site_donator = "";
}


The $userinfo global was something Telli suggested in another forum post for something I was tweaking. It is pulling the following from my mainfile.*php*:

global $user;
if (is_user($user)) {
    $userinfo = getusrinfo($user);
}


Thanks in advance!

MJ



_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#2   
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
Well, looks like I'm way off because it's returning the text for every user.




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#3   re: Show Site Donators Icon In Forums
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
So I said to myself..."Self? Can we figure something out?"

Okay, well I love this site so much that I keep notes here sometimes as I go along, so thanks for hangin' in there with me.

Here's what I've done so far.

Using the CZUser-Info block, I edited the code as follows:

Around line 101, I removed "//" from before the line to activate the code

     $uid = intval($session['user_id']);


After
$url = $session['url'];

I added
     $donator = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_donators WHERE donshow = 1 AND uid = $uid"));
     
     if ($donator > 0) {
        $site_donator = "<img border='0' title='$uname is a $sitename Site Donator!' src='/images/CZUser/donator.gif'>";
        } else {
        $site_donator = "";
     }

Make not that I put a donator.gif file my images/CZUser dir.

Then, around line 133 I changed

                 if ($ulevel == 2) {
                 $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\"  title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a>&nbsp;<img src=\"images/CZUser/admin.gif\">\n";
                 }
                 elseif ($ulevel == 3) {
                 $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\"  title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a></font>&nbsp;<img src=\"images/CZUser/staff.gif\">\n";
                 }
                 else {
           $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\" title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a></font>\n";
          }

TO
                 if ($ulevel == 2) {
                 $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\"  title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a>&nbsp;<img src=\"images/CZUser/admin.gif\"> $site_donator\n";
                 }
                 elseif ($ulevel == 3) {
                 $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\"  title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a></font>&nbsp;<img src=\"images/CZUser/staff.gif\"> $site_donator\n";
                 }
                 else {
           $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\" title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a></font> $site_donator\n";
          }


Seems to be working. I'm going to play with the forum one now. Telli, feel free to laugh if I went about this all wrong, I'm a newb. I'm going to post a copy of this in the Scripts forum too if anyone wants it.



_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum