Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
voodu191

API создание сообщения в теме

Recommended Posts

единственное что нашел это

 

<?php
       if (!defined('IPB3_ROOT')) {
           define('IPB3_ROOT', '/home/admin/domains//public_html');
       }

       define('IPB_THIS_SCRIPT', 'public');
       define('IPS_PUBLIC_SCRIPT', 'index.php');
       define('IPS_ENFORCE_ACCESS', true);

       require_once IPB3_ROOT.'/initdata.php';
       require_once IPS_ROOT_PATH.'sources/base/ipsRegistry.php';
       require_once IPS_ROOT_PATH.'sources/base/ipsController.php';

       ipsRegistry::init();

$classToLoad			= IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php', 'classPost', 'forums' );
$classToLoad			= IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' );
$this->post				= new $classToLoad($this->registry);

try
{
$this->post->setBypassPermissionCheck( true );
$this->post->setIsAjax( true );
$this->post->setPublished( true );
$this->post->setTopicID( 123 );
$this->post->setForumID( 2 );
$this->post->setForumData( $this->registry->class_forums->getForumById( 2 ) );
$this->post->setAuthor( IPSMember::load( 1 ) );
$this->post->setPostContentPreFormatted( "This is the already formatted post" );
$this->post->setSettings( array( 'enableSignature' => 1,
						   'enableEmoticons' => 1,
						   'post_htmlstatus' => 0 ) );

if( $this->post->addReply() === false )
{
	print_r( $this->post->getPostError() );

	return false;
}

$post	= $this->post->getPostData();
}
catch( Exception $e )
{
print $e->getMessage();

return false;
}
?>

 

 

но оно не работает выдает ошибку Fatal error: Using $this when not in object context in /home/admin/domains//public_html/444.php on line 22

Edited by voodu191

Share this post


Link to post
Share on other sites

по ссылке создание темы, а мне нужно сообщение в теме. Вот в чем дело

Share this post


Link to post
Share on other sites

По ссылке еще говорится о некоем методе addReply того же класса, с ссылкой на документацию.

Очевидно нужно заменить addTopic на addReply, добавить ид темы setTopicID() и убрать ненужный setTopicTitle. В итоге получится http://ipbskins.ru/forum/topic8466.html#entry84784

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...