Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Awards Hack Details »»
Awards Hack
Version: , by Dean C Dean C is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 04-30-2003 Last Update: Never Installs: 0
 
No support by the author.

I have this one user on my forums. Lets call him Bob. Now in his profile with the awards each award is listed 5 times. Now as far as i can tell from editing some people's profiles in the ACP it is only happening to this user. I just can't pick up on why this happening.

Now one thing i can confirm is that each award appears 5 times. Now if i click the one awards tick box once out of the five times it appears - when going back to the page all five tickboxes are clicked for that award. So it's definately a case of a faulty loop of some sort.

Here is the code from user.php to generate the list of awards. Can someone perhaps pinpoint any possible problems with a certain users name or if the email contains special characters or something like that...


PHP Code:
// award/medals/card hack by lesane

          
maketableheader("Awards");
          
makeyesnocode("Enable awards for $user[username]?","hasaward",$user[award]);
          
$result mysql_query("SELECT * FROM useraward where userid='$user[userid]'");
          if (
$row mysql_fetch_array($result)) {
          
$toegang="yes";
          } else {
          
$toegang="no";
          }
                if (
$toegang=="yes") {
           
$result=$DB_site->query("SELECT awardsid,name,url,userid,aw FROM useraward where userid=$user[userid]");
           while(
$award mysql_fetch_array($result) ) {
            
$lesane="yes";
              
$id $award[awardsid];
             if(
$award[aw] == "$idand $award[userid] == "$user[userid]") {
         
$lala=" checked";
         
$up="equal";
         } else {
         
$lala="";
         
$up="not_equal";
         }

                  echo 
"<tr class='".getrowbg()."'><td><input type='checkbox' name='aw[$id]' value='yes'";
                  echo 
"$lala>$award[name]</td><td nowrap>";
                  echo 
"<input type=\"hidden\" name=\"all[$id]\" value=\"$up\">";
                  echo 
"<img src=\"$award[url]\">&nbsp;&nbsp;&nbsp;</td>";
                }

                echo 
"<input type=\"hidden\" name=\"lessie\" value=\"$lesane\">";

                } elseif (
$toegang=="no") {
                  
$noawa=$DB_site->query("SELECT awardsid,name,url,aw FROM award");
              while(
$useraward mysql_fetch_array($noawa) ) {
                   
$id $useraward[awardsid];
                  
$lesane="no";
              echo 
"<tr class='".getrowbg()."'><td><input type='checkbox' name='uaw[$id]' value='yes'";
                  if (
$uaw =='yes') {
                  echo 
" checked>$useraward[name]</td><td nowrap>";
                  
$userup='equal';
                  } else {
                  echo 
">$useraward[name]</td><td nowrap>";
                  
$userup='not_equal';
                 }
                  echo 
"<input type=\"hidden\" name=\"uall[$id]\" value=\"$userup\">";
                  echo 
"<img src=\"$useraward[url]\">&nbsp;&nbsp;&nbsp;</td>";
          echo 
"<input type=\"hidden\" name=\"userhomes[$id]\" value=\"$useraward[name]\">";
                  echo 
"<input type=\"hidden\" name=\"userurls[$id]\" value=\"$useraward[url]\">";

                 }
                 echo 
"<input type=\"hidden\" name=\"lessie\" value=\"$lesane\">";
       }
           
//  end award/medals/card hack by lesane 
Thanks in advance

- Dean

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-30-2003, 07:06 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Useless reply but I ditched that horrible awards hack a long time ago; at WDF I simply have an admin-only-editable hidden profile field that has the actual HTML for the awards
Reply With Quote
  #3  
Old 05-01-2003, 03:50 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea but i like the ease in which i can add awards with the store hack and how there is an add-on to display who has what award etc.

I just like the way it works. See any flaws in code then buddy ?

- miSt
Reply With Quote
  #4  
Old 05-01-2003, 07:20 PM
GaleForce GaleForce is offline
 
Join Date: Sep 2002
Location: New York
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Yesterday at 09:06 PM filburt1 said this in Post #2
Useless reply but I ditched that horrible awards hack a long time ago; at WDF I simply have an admin-only-editable hidden profile field that has the actual HTML for the awards
Hey... thats a really good idea, but I like being able to hit the checkbox to add them. Needless to say though, it was a good move just adding the field, because not only can it display in the postbit, but it shows up in the profile too
Reply With Quote
  #5  
Old 05-03-2003, 12:36 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok i have not found the cause of this problem but i've made some progress. I counted the num of rows outputted by the loop. And outputted it. Now I have 5 awards and for this user the query is looping 5 times so in total it performs 25 queries

Now i kind of solved it in the admin cp by making a new setting in the vbulletin options which i enter how many awards there are and then add a LIMIT $numawards to the query. $numawards being the global variable. Now this solved the problem in the ACP. But in functions.php the global variable cannot be accessed - therefore i can't stop the award looping in the postbit too

Any ideas?

- miSt
Reply With Quote
  #6  
Old 05-03-2003, 05:40 PM
eoc_Jason's Avatar
eoc_Jason eoc_Jason is offline
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 493
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I noticed the hack wasn't using some of the standard vB functions for accessing mysql stuff, so I fixed that, but I doubt it will correct the situation with your multiple's of 5...

I'm going to D/L the hack itself and take a look at it, I'm looking at variables that I have no clue what they mean or anything..

PHP Code:
// award/medals/card hack by lesane

          
maketableheader("Awards");
          
makeyesnocode("Enable awards for $user[username]?","hasaward",$user[award]);

          
$result $DB_site->query_first("SELECT * FROM useraward where userid='$user[userid]'");
          if (isset(
$result[userid])) { $toegang="yes"; } else { $toegang="no"; }

          if (
$toegang=="yes") {
            
$result=$DB_site->query("SELECT awardsid,name,url,userid,aw FROM useraward WHERE userid='$user[userid]'");
            while( 
$award $DB_site->fetch_array($result) ) {
              
$lesane="yes";
              
$id $award[awardsid];
              if(
$award[aw] == $id && $award[userid] == $user[userid]) {
                
$lala=" checked";
                
$up="equal";
              } else {
                
$lala="";
                
$up="not_equal";
              }
              echo 
"<tr class='".getrowbg()."'><td><input type='checkbox' name='aw[$id]' value='yes'";
              echo 
"$lala>$award[name]</td><td nowrap>";
              echo 
"<input type=\"hidden\" name=\"all[$id]\" value=\"$up\">";
              echo 
"<img src=\"$award[url]\">&nbsp;&nbsp;&nbsp;</td>";
            }
            echo 
"<input type=\"hidden\" name=\"lessie\" value=\"$lesane\">";

          } elseif (
$toegang=="no") {

            
$noawa=$DB_site->query("SELECT awardsid,name,url,aw FROM award");
            while(
$useraward $DB_site->fetch_array($noawa) ) {
              
$id $useraward[awardsid];
              
$lesane="no";
              echo 
"<tr class='".getrowbg()."'><td><input type='checkbox' name='uaw[$id]' value='yes'";
              if (
$uaw =='yes') {
                echo 
" checked>$useraward[name]</td><td nowrap>";
                
$userup='equal';
              } else {
                echo 
">$useraward[name]</td><td nowrap>";
                
$userup='not_equal';
              }
              echo 
"<input type=\"hidden\" name=\"uall[$id]\" value=\"$userup\">";
              echo 
"<img src=\"$useraward[url]\">&nbsp;&nbsp;&nbsp;</td>";
              echo 
"<input type=\"hidden\" name=\"userhomes[$id]\" value=\"$useraward[name]\">";
              echo 
"<input type=\"hidden\" name=\"userurls[$id]\" value=\"$useraward[url]\">";
            }
            echo 
"<input type=\"hidden\" name=\"lessie\" value=\"$lesane\">";

          } 
// END if/elseif

//  end award/medals/card hack by lesane 
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 11:11 PM.


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.03988 seconds
  • Memory Usage 2,313KB
  • Queries Executed 19 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete