Here's how I achieved this for now until I find out if it's the recommended way.
//.. after $creator->save();
$creator->getThread()->set('post_date', $date_unix);
$creator->getThread()->save();
I have now realised that the code above works. However the visibility of the custom thread field was set to Admin only. I assume doing asVisitor() means that the account I post from would need Admin privs.
This thread can be closed. Hope the above is useful to anyone else in future.
Is it possible, when using the following code, to set the date for the post? I see no methods for this on the reflection class.
$user = \XF::em()->find('XF:User', $data['user_id']);
$forum = \XF::em()->find('XF:Forum', $data['forum_id']);
\XF::asVisitor($user, function() use ($forum, $data) {...
Hi there,
I looked around and searched a lot to find information on this, but was unable to deduct how the
XF:Thread\Creator ->setcustomFields(array) works exactly
I've tried the following...
$user = \XF::em()->find('XF:User', $data['user_id']);
$forum = \XF::em()->find('XF:Forum'...