PDA

View Full Version : Set iconid when creating custom thread


Ducks
09-16-2007, 12:30 PM
I'm using this to create threads from my own files:

// Backend files
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');

// Setup Variables
$forumid = 23; // The forum id that you want the thread posted in
$postuserid = 1328; // The Userid of the poster
$postusername = "Justin"; // The username of the poster
$title = "This just in: " . $username . " joins our Forums..."; // The thread title

// Don't change below this line

// Start thread create
$threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);

$username = htmlspecialchars_uni($username);
$allowsmilie = '1';
$visible = '1';
eval('$pagetext .= "' . fetch_template('welcome_thread') . '";');

// Insert thread
$threaddm->do_set('forumid', $forumid);
$threaddm->do_set('postuserid', $postuserid);
$threaddm->do_set('userid', $postuserid);
$threaddm->do_set('username', $postusername);
$threaddm->do_set('pagetext', $pagetext);
$threaddm->do_set('title', $title);
$threaddm->do_set('allowsmilie', $allowsmilie);
$threaddm->do_set('visible', $visible);
$tid = $threaddm->save();

// Update last post stuff on forumdisplay
require_once('./includes/functions_databuild.php');
build_forum_counters($forumid);

But I've trouble adding an 'icon id', I've tried to add

$threaddm->do_set('iconid', '10');
And
$threaddm->do_set('iconid', 10);

But none of them work. Any ideas?

Dismounted
09-16-2007, 12:39 PM
What's the fieldname in the database ;)?

Ducks
09-16-2007, 01:32 PM
iconid, but how does that helps me?

Opserty
09-16-2007, 02:06 PM
Use $threaddm->set() instead of $threaddm->do_set() they are the same but I think $threaddm->set() verifies the contents.

Also you probably need to pass the value as a variable if I remember correctly.

So it would be:

$iconid = 10;
$threaddm->set('iconid', $iconid);

// $threaddm->save()...

Ducks
09-16-2007, 03:09 PM
That works, thank you