I was trying to have a thread auto created. This was working fine, but the other day is created the post with the wrong userid.
PHP Code:
$userid = 2746;
$forumid = 84;
$foruminfo = fetch_foruminfo($forumid);
$bbuserinfo = fetch_userinfo($userid);
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo[userid] . $bbuserinfo[salt]);
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);
So instead of userid 2746 for the thread starter, it was someone else completely.
I thought maybe $userid was being updated elsewhere in some other script and just happened to mess up my script. So I figured I would change the userid to something unique.
PHP Code:
$x_userid = 2746;
$x_forumid = 84;
$x_foruminfo = fetch_foruminfo($x_forumid);
$x_bbuserinfo = fetch_userinfo($x_userid);
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $x_bbuserinfo[userid] . $x_bbuserinfo[salt]);
build_new_post('thread', $x_foruminfo, array(), 0, $post, $errors);
I tried this with leaving $post as is, or changing it to a new variable as well. But no matter what, this code would not make the thread.
The old code works fine except for the one time when it posted under the wrong user name. So I am trying to understand what the problem could have been.
Any ideas?
Thanks
Jake