PDA

View Full Version : I'm a $=sniff away from nailing this...


b6gm6n
08-04-2005, 12:39 PM
Hi..

Need a little help with a mod i've created for 3.5, it's a forum link counter ported from the original (author agreed for me to complete this) - so i've made it... it works, but theres one thing i wanted to do but which is giving me a headache trying to understand and i hope you might be able to help me...

The product installs ok, (there are 2 edits to one php file) but anyways the forum link counter works well.

Then i added some admin options (all done via the xml install so it's automatic) to reset the counter or input a value to start counting from, this works to... BUT > I thought to myself... what if a user creates more than one redirect forum link? - so i added an extra admin setting to choose the (forumid) and this also works... this is where i found my problem... although the counter is working, i can reset or create a value for the counter (or counters) i choose the forumid value i created gets lost or stuck (for want of a better phrase)

for example, i have 2 forum links, both counters show values, i can enter a value from admin ok and this gets displayed depending on the 'forumid' i enter, i refresh the forum home and it shows, i click the link, it updates the counter... i can do this with the other forum link also...enter a value from admin...sorted... but the only one counter updates...(the forum id is lost or stuck)

http://www.hardwired.myftp.org/forum/index.php <-example

anyways, check the code of my admin plugin below and see if i've done anything wrong... i've created the 'varnames' from the custom admin settings and simple tried to enter them in the plugin to get the forum id

counter admin plugin code >

$hit_start = ($vbulletin->options['hit_start']);

$hit_forum_id = ($vbulletin->options['hc_forumid']);

$Query = "Update " . TABLE_PREFIX . "forum SET linkhits = $hit_start WHERE forumid='$hit_forum_id'";
$vbulletin->db->query($Query);

"hit_start" = the varname i used for one of my admin settings, also "hc_forumid" self explainitory really...

as i say i can alter the counter values from admin ok (any forum id) this works, but it buggers the rest of the counters on the forum home and only updates one of them....(unless i go back to admin options i created for this mod and enter a new forumid and value for the counter, click save...then the other counter works...) ... i need help! :) sorry for the long post!

please help!!!!

-b6

amykhar
08-04-2005, 02:02 PM
I'm just guessing cause I'm not seeing the code in context, but perhaps you should be using an array.

Instead of $hitstart, it might be $hitstart[$forumid] or something like that. What could be happening is that you are pulling all the hitstarts down for the forms, but the each successive one overwrites the previous.

As I said, I may be all wet on this one, but that would be my first hunch.

b6gm6n
08-04-2005, 04:15 PM
bugger me i got it working! (Kinda) - hey thanx amykhar! - it was my hook location, i had the admin plugin using 'global_start' which in turn was reseting my forum id... the code was ok, i just needed to alter the hook location... i can now get both counters working, but i have a weird behaviour in the updating of the counter from admin...

i have to click update twice?? weird... it works, but why twice? my hook location for the admin plugin is : admin_options_processing

yep, definatly have to click save twice for this to work.... bum! :)

-b6