2008-10-23, 01:52 PM
Hi!
I'm working now on Drupal bridge to MyBB. One of desirable features for this app is single sign-on (SSO). I made login from MyBB plugin to Drupal site and its works with such code:
because Drupal allows to use it from other scripts. Just needed include bootstrap.inc and execute drupal_bootstrap(), then you may use Drupal functions - login, logout, save nodes, users etc.
But on other side I get in troubles
I tried to initialize MyBB from Drupal module:
No errors, init seems successfull, but I not found way how to login user to MyBB site from Drupal module. Dances around member.php not get me success. MyBB hooks also seems unuseful for this case. Fallback way is to imitate MyBB cookies and set them from Drupal directly, but I hope maybe another way exists?
Well... my questions are:
What is right way to include MyBB to external scripts and execute MyBB functions?
Is there method for external login/logut user to MyBB site?
Is ther methods for other operations like create/modify/delete threads/replies and so on?
Thank for any useful suggestions.
I'm working now on Drupal bridge to MyBB. One of desirable features for this app is single sign-on (SSO). I made login from MyBB plugin to Drupal site and its works with such code:
include('./includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
user_authenticate(array('name' => $mybb->input['username'], 'pass' => $mybb->input['password']));
because Drupal allows to use it from other scripts. Just needed include bootstrap.inc and execute drupal_bootstrap(), then you may use Drupal functions - login, logout, save nodes, users etc.
But on other side I get in troubles
I tried to initialize MyBB from Drupal module:
global $db, $lang, $mybb, $mybbgroups, $time, $cache, $plugins, $session, $groupscache, $displaygroupfields, $templates;
global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
include("global.php");
include(MYBB_ROOT."inc/functions_post.php");
include(MYBB_ROOT."inc/functions_forumlist.php");
include(MYBB_ROOT."inc/class_parser.php");
No errors, init seems successfull, but I not found way how to login user to MyBB site from Drupal module. Dances around member.php not get me success. MyBB hooks also seems unuseful for this case. Fallback way is to imitate MyBB cookies and set them from Drupal directly, but I hope maybe another way exists?
Well... my questions are:
What is right way to include MyBB to external scripts and execute MyBB functions?
Is there method for external login/logut user to MyBB site?
Is ther methods for other operations like create/modify/delete threads/replies and so on?
Thank for any useful suggestions.