vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need some help with a simple cron script (https://vborg.vbsupport.ru/showthread.php?t=186168)

neverstop 07-23-2008 09:22 PM

Need some help with a simple cron script
 
Hey guys,

i have a cron script that moves a thread from one forum to another, and updates the thread timestamp to the current time. The problem is that there is another timestamp for the actual post. Can someone help me modify the following code to update the timestamp on the post as well?

Thanks in advance

PHP Code:

$l $vbulletin->db->query_first("
    SELECT threads.threadid
    FROM vb_thread AS threads
    WHERE threads.forumid=5
"
);
$vbulletin->db->query_write("
    UPDATE vb_thread 
    SET forumid=2, dateline=UNIX_TIMESTAMP()
    WHERE threadid="
.$l['threadid']
); 


briansol 07-23-2008 11:02 PM

you also need to update the post table

neverstop 07-24-2008 04:59 PM

Quote:

Originally Posted by briansol (Post 1582687)
you also need to update the post table

Yes I realize that, but I need help doing it heh. Im not much a programmer, I dont know how to update the post table in that query. Can anyone help a brother out?

Cheers

Lynne 07-24-2008 05:05 PM

Which post are you trying to update the date/time on? Just the first post? If so, you need to grab the "firstpostid" in your first query also (add threads.firstpostid to your select statement). Then you need to add a second write query to update the post table using the "firstpostid" as your "postid".

neverstop 07-24-2008 08:29 PM

Quote:

Originally Posted by Lynne (Post 1583235)
Which post are you trying to update the date/time on? Just the first post? If so, you need to grab the "firstpostid" in your first query also (add threads.firstpostid to your select statement). Then you need to add a second write query to update the post table using the "firstpostid" as your "postid".

Thanks Lynne, I got it working thanks to your help.

Cheers

Marco van Herwaarden 07-25-2008 07:21 AM

You can not only change the date/time of the first post. Posts are ordered by timestamp, so if you change the postdate of the first post to a later date, it could become the last post instead of the first.


All times are GMT. The time now is 01:00 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.01150 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete