kamilkurczak
07-18-2011, 04:52 PM
Hello,
I wrote my own system to save post on outside forum page (using data manager). Post is saved correctly but after save I have a blank page with : "Access denied." message.
example of my code:
global $vbulletin;
require_once(CWD . '/includes/init.php');
require_once(CWD . '/includes/functions_misc.php');
require_once(CWD . '/includes/functions_databuild.php');
$foruminfo = fetch_foruminfo($forum_id);
$threadinfo = fetch_threadinfo($thread_id);
$postdm =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
//$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
// set options
//$postdm->setr('showsignature', $post_data['signature']);
$postdm->setr('allowsmilie', $post_data['enablesmilies']);
//$postdm->setr('htmlstate', $post['htmlstate']);
// set data
$postdm->setr('userid', $post_data['userid']);
$postdm->setr('threadid', $post_data['threadid']);
$postdm->setr('parentid', $post_data['parentid']);
//$postdm->set('username', $post_data['username']);
$postdm->setr('title', $post_data['title']);
$postdm->setr('pagetext', $post_data['pagetext']);
$postdm->setr('iconid', $post_data['iconid']);
$postdm->setr('visible', $post_data['visible']);
$postdm->setr('dateline', time());
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->pre_save();
if(!empty($postdm->errors))
{
return $postdm->errors;
}
else
{
$post_id = $postdm->save();
build_thread_counters($threadinfo);
build_forum_counters($foruminfo);
return $thread_id;
}
can you help me? Thanks
I wrote my own system to save post on outside forum page (using data manager). Post is saved correctly but after save I have a blank page with : "Access denied." message.
example of my code:
global $vbulletin;
require_once(CWD . '/includes/init.php');
require_once(CWD . '/includes/functions_misc.php');
require_once(CWD . '/includes/functions_databuild.php');
$foruminfo = fetch_foruminfo($forum_id);
$threadinfo = fetch_threadinfo($thread_id);
$postdm =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
//$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
// set options
//$postdm->setr('showsignature', $post_data['signature']);
$postdm->setr('allowsmilie', $post_data['enablesmilies']);
//$postdm->setr('htmlstate', $post['htmlstate']);
// set data
$postdm->setr('userid', $post_data['userid']);
$postdm->setr('threadid', $post_data['threadid']);
$postdm->setr('parentid', $post_data['parentid']);
//$postdm->set('username', $post_data['username']);
$postdm->setr('title', $post_data['title']);
$postdm->setr('pagetext', $post_data['pagetext']);
$postdm->setr('iconid', $post_data['iconid']);
$postdm->setr('visible', $post_data['visible']);
$postdm->setr('dateline', time());
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->pre_save();
if(!empty($postdm->errors))
{
return $postdm->errors;
}
else
{
$post_id = $postdm->save();
build_thread_counters($threadinfo);
build_forum_counters($foruminfo);
return $thread_id;
}
can you help me? Thanks