vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Set iconid when creating custom thread (https://vborg.vbsupport.ru/showthread.php?t=157962)

Ducks 09-16-2007 11:30 AM

Set iconid when creating custom thread
 
I'm using this to create threads from my own files:

Code:

// 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

Code:

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

$threaddm->do_set('iconid', 10);
But none of them work. Any ideas?

Dismounted 09-16-2007 11:39 AM

What's the fieldname in the database ;)?

Ducks 09-16-2007 12:32 PM

iconid, but how does that helps me?

Opserty 09-16-2007 01: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:
PHP Code:

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

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


Ducks 09-16-2007 02:09 PM

That works, thank you


All times are GMT. The time now is 06:51 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.01485 seconds
  • Memory Usage 1,719KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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