View Single Post
  #8  
Old 08-16-2004, 08:59 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ocean
Colin, you are the best! That worked perfectly. I found that since I have redirects turned off on my board, the added phrase was irrelevant, and I used the default "redirecting" phrase.


Now, when you helped me with the first stage of my modification, I posted this question seperately because I didn't want to assume that you were interested in continuing to help me. But here we are, together again for step two (did I already thank you? ).

That being the case, I have one last step remaining - and I figure I might as well ask you since you've stuck with me this far... <grin> But if you're not interested, just say so, and I'll happily make it a seperate post.




The last thing I want to do, is to add another field to the "thread" table, which will store the date and time that the Reset Counter link we just added was last clicked. So, the chart of what I need is this:


1. I need to create a new field that will store the date and time for each thread that the counter was reset. When I created the first "whoviewedcounter" field, I did so with this query:

ALTER TABLE thread ADD whoviewedcounter TEXT NOT NULL;

However, I'm not sure what the query would be to add the proper field (let's call it "whoviewedreset") type we would need to store this information.


2. I need to be able to access the date/time so that I can insert it into the ShowThread template - I don't know if it would be in the format of "$vbphrase[whoviewedreset]", or if it's not that simple. Needless to say, I'm not sure what the best way to do this is.


3. If there is no date/time stored for a particular thread, I would imagine that the phrase should show as "Never".


4. When I click on the "Reset Counter" link we just worked on, the script in Misc.php should also update the date/time in the "whoviewedreset" field of that thread.



Whew! That seems like a lot more than it really is, I would imagine. But in any case, if you feel like helping me work this last part out, it would be greatly appreciated! If not, that's okay too. You've been more than generous so far, and I am extremely grateful for the assistance you have already given me.
Not that hard....


1. ALTER TABLE `testvb_thread` ADD `whoviewedreset` INT( 10 ) UNSIGNED NOT NULL ;

2. The data in there should be in $thread[whoviewedreset] or $threadinfo[whoviewedreset], I'm not sure
You would have to insert something like this in the showthread.php file and call the date with the var $whoviewedreset

if ($thread['whoviewedreset'] != '')
{
$whoviewedreset = vbdate('$vboptions[dateformat]', '$thread[whoviewedreset]');
}
else
{
$whoviewedreset = "Never";
}


3. solved in 2.

4. $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedreset = " . TIMENOW . " WHERE threadid = $threadid");


Next time just ask me to code the script for you
No, I'm glad to be of help. I'm sure you'll get the hang of it sooner or later



(I have the feeling I forgot something, not sure what though...)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01167 seconds
  • Memory Usage 1,782KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete