The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
Hi,
I want to use data manager to create a new thread and I want the first post to contain line breaks. But I don't want to make the forum allow HTML, so I cannot use <br>. Here's my code: Code:
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$forumid = 27;
$userid = 33256;
// $mytitle and $mytext actually come from extern
$title = addslashes($mytitle);
$pagetext = addslashes($mytext);
$url = 'http://www.google.de'; // just a sample
$pagetext .= '\n\nClick here';
$allowsmilie = '0';
$visible = '1';
$foruminfo = fetch_foruminfo($forumid);
$threadinfo = array();
$user = htmlspecialchars_uni(fetch_userinfo($userid));
$threaddm->set_info('forum', $foruminfo);
$threaddm->set_info('thread', $threadinfo);
$threaddm->setr('forumid', $forumid);
$threaddm->setr('userid', $userid);
$threaddm->setr('pagetext', $pagetext);
$threaddm->setr('title', $title);
$threaddm->set('allowsmilie', $allowsmilie);
$threaddm->set('visible', $visible);
$threadid = $threaddm->save();
Quote:
Quote:
Regards TiKu |
|
#2
|
|||
|
|||
|
Escape sequences like \n only work in double-quoted strings. So if you change your pagetext line like:
Code:
$pagetext .= "\n\nClick here"; it should work. |
|
#3
|
||||
|
||||
|
Argh! Many thanks, without your help I would have been searching the error for days.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|