Version: , by jsell
Developer Last Online: Sep 2004
Version: Unknown
Rating:
Released: 09-06-2002
Last Update: Never
Installs: 0
No support by the author.
Hey everyone first of all i would like ot thank you in advance for the help but here it goes
i am trying to hack my own "admin Recommended" type of hack where I replace the post icon's with a yes or a no icon at my choosing. I want it to show up in the forumdisplay when i choose if i want to reccomend the thread or not. I have everything working except it doesn;t diplay the icon's correctly. obviously there is soemthing wrong with my code. I am pretty new to php and to Vbulletin so please go easy one me.
PHP Code:
// reco hack
unset($recodata);
unset($reco);
$recodata=$DB_site->query("SELECT reco from recodata data WHERE threadid='$threadid'");
if (($recodata[recomend]==1)) {
eval("\$reco= \"".gettemplate("reco_yes")."\";");
Youre problem was that you were not getting the values of the query into an array. Whenever you create a array from a query, you must put it in $array[element] form. "element" is usually the name of the column selected in the array. You had a number of small syntax errors in the code.
Also, because this is getting values of many threads, you need to put the code in a while loop, and fetch or extract the array. This while loop has already been made in forumdisplay.php ofcourse.
So in forumdisplay.php, find:
PHP Code:
while ($thread=$DB_site->fetch_array($threads)) { // and $counter++<$perpage) {
And below it place your code.
Try the above code, I hope it works since I'm not all that sure what you are doing.
Thanks for your help Velocd but there is still a problem:
let me try a more detailed explination and tell you some more test's I have run
What i have done is I added a input field in "showthread" where I can select yes/No for if I recomend a thread to a user to read. For now I am going to replace the message icon with a yes/no icon in the forum display (later I will add a new box in the table for it so I have both icon's) evrythign is wokring except the forum display in thee database if I choose "yes" it enters a value of 1 if i choose "no" i enters a value of 2 etc.
what happens when i enter the code in "forumdisplay.php" your's or mine, is that every thread show's the same icon the icon inside the "reco_no" template.
So to try to test this in the forumdisplaybit template i put the variable $recodata[reco] and it comes up as a blank for every thread even though the database has value's for all of them
My conclusion:
that for some reason the Query is not getting the info form the database (double and triplechecked the table names etc. ) but I can't figure out why it's doing that maybe the
PHP Code:
WHERE threadid='$threadid'
part is incorrect but i can't find diferent variable to use