Show Site Donators In CZUser-Info Block

  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 In CZUser-Info Block
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, I really like just about everything Telli creates, so I'm using the CZUser-Info block at my site. I noticed that Telli's got some code here at CZ that changes the color of the text for in his block when that user is a site donator and wanted something similar. Here's what I came up with...if anyone has a better way to do this, please share ! icon_biggrin.gif


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']);


Then I found
$url = $session['url'];

and added this after it:
     $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";
          }


Saved and closed and it's workin' for me. Hope you like it!



_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
The only problem with this is for every member that you have online it will do one extra query. Same with your Forums if your post has 10 posts per page then thats 10 extra querys for that page. Best way to do it is to add it in the ipn.


ALTER TABLE nuke_users add user_donator int(11) not null default '0';


Then in your ipn do a sql query to the uses table if there a user:


$db->sql_query("UPDATE {$prefix}_users set user_donator='1' WHERE user_id='$option_selection1'");


Then you just add that field to the user block:


    $members = $db->sql_query("SELECT w.uname, w.module, w.url, u.user_id, u.user_level, u.user_allow_viewonline, u.user_donator FROM ".$prefix."_session AS w LEFT JOIN ".$prefix."_users AS u ON u.username = w.uname WHERE guest = '0' ORDER by u.user_id ASC");


Then to use it:


if ($session['user_donator'] == 1) {
    $donator = "<img src=images/donator.gif>";
} else {
   $donator = "";
}


Of course that just a rough explanation but I'm sure you get the idea.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   
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 
I'll check it out after work, thanks Telli! Any idea where I'd start with the forums? I saw the viewtopy_body.tpl file, but I'm not sure how it interacts with and gets information from the rest of the module. Still learning... icon_rolleyes.gif




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
You would want to pull the information in the viewtopic.php then define it into the viewtopic_body.tpl. If you look at how the username goes through you could probably figure out pretty easily.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   
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 
Thanks Telli, I'll take a look tonight and post back what I did if any cares to look for 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