Jump to content

IP.Board 3: Networking And Integration

Brandon blogged a while back about IP.Board's integration points.

I wanted to spend a moment discussing the features within IP.Board 3 that all you integrate the board with your website and to create your own network.

Member Management
Since IP.Board 2, we've had, what we call, "Log In Modules". This is basically a mini-framework to allow custom code to be used easily when authenticating and registering members. For example, if you had a database full of members and you wanted for them to be able to use their existing usernames and passwords, you could add a log in module to query your database or other system (via SOAP, XML-RPC, etc) for authentication.

This system has been enhanced based on user feedback and IP.Board now ships with modules for LDAP and OpenID which will make it much easier to use existing authentication.

The log in modules also tie into our 'IP.Converge' product which allows you to share authentication details across multiple IP.Board installations. The IP.Boards don't even need to be on the same server! In fact, we use Converge and the log in modules ourselves so that our customers can use the same log in details on the forum as they do in our ticket center.
You could use this functionality to share members across many forums, creating a true network of members.

Using the IP.Board Engine

We've made no secret that IP.Board 3 is a complete rewrite. The new framework makes full use of PHP 5 and incorporates many timesaving features that you can instantly make use of.

It's common for our customers to ask how they can use certain parts of IP.Board within their own website. For example, they'd like to show a list of recent topics or posts. That's no problem as we've had an API class interface since IP.Board 2.

However, if you wanted to send data to IP.Board, such as a new post or new personal message; things got tricky. Even using a template bit required a lot of code copying.

For example, if you wanted to make use of our database engine or templating engine, you would need to copy a lot of 'index.php' so that it set up ipsclass correctly. With IP.Board 3, that is no longer required. You can use our engine in your own scripts as simply as this:

  require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );    $registry = ipsRegistry::instance();  $registry->init();

require_once( './initdata.php' );

Those few lines of code give you access to: Caches, settings, member management, database management and more.

Writing your own code
Quite often, you want to add some IP.Board functionality to your own website. With IP.Board 3.0.0 it's very simple.

You want to add a new post? No problem, simply use that code above and add:

    $postClass = new classPostForms( $registry );  $postClass->setForumID( $forumID );  $postClass->setForumData( $this->registry->class_forums->forum_by_id[ $forumID ] );  $postClass->setTopicTitle( "My Topic" )  $postClass->setPostContent( "Hello, I am post content!" );  $postClass->setAuthor( $memberID );    try  {      $postClass->addTopic();  }  catch( Exception $error )  {      print $error->getMessage();  }

require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );

It's really as simple as that! Note the try -> catch block? That's consistent with all the new API-like functions. We take advantage of the PHP 5 exception handler to return information on what went wrong. We also list all the possible exceptions that are returnable in the phpDoc for that function.

Of course, seasoned modification authors will already be familiar with functions similar to those present in IP.Board 2's API system. The good news here is that this functionality doesn't require an API bridge anymore, it's the exact same code that is used in the normal posting routines.

Do you want to send a new personal conversation to someone in your own code? Simple!

  $messengerFunctions = new messengerFunctions( $registry );  $messengerFunctions->sendNewPersonalTopic( $toMemberID, $fromMemberID, $invitedUserIDArray, $msgTitle, $msgContent );

require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );

Want to get a list of PMs in your own code?

  $messengerFunctions = new messengerFunctions( $registry );  $messengerFunctions->getPersonalTopicsList( $memberID, 'in' );

require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );

Another common request is to use IP.Board's templates in your own projects, again this is as simple as:

  require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );    $registry = ipsRegistry::instance();  $registry->init();    print $registry->output->getTemplate( $templateGroup )->templateName( $templateArguments);

require_once( './initdata.php' );

There really is so much that you can do. Listing them all would make for a very large blog entry indeed! We will of course be providing a lot of documentation on these new features.

Combine this functionality with the new hooks and plug-ins system and you've got a very quick way to build new code using our core. We're very excited to see what you do with it!

  • Create New...