Hi I've got everything setup as in the examples but I am getting a strange permissions error. Perhaps someone can help me figure this out?
The following warnings occurred:
Warning [2] Illegal offset type - Line: 1173 - File: forums\inc\functions.php
forums\inc\functions.php line 1173 - errorHandler->error
forums\inc\functions.php line 1141 - fetch_forum_permissions
forums\inc\class.MyBBIntegrator.php line 211 - forum_permissions
forums\index.php line 29 - MyBBIntegrator->getLatestThreads
Warning [2] Illegal offset type - Line: 1141 - File: forums\inc\functions.php
forums\inc\functions.php line 1141 - errorHandler->error
forums\inc\class.MyBBIntegrator.php line 211 - forum_permissions
forums\index.php line 29 - MyBBIntegrator->getLatestThreads
Warning [2] Illegal offset type - Line: 1143 - File: forums\inc\functions.php
forums\inc\functions.php line 1143 - errorHandler->error
forums\inc\class.MyBBIntegrator.php line 211 - forum_permissions
forums\index.php line 29 - MyBBIntegrator->getLatestThreads
Warning [2] Invalid argument supplied for foreach() - Line: 30 - File: forums\index.php
forums\index.php line 30 - errorHandler->error
in the INDEX.PHP File this is what I have:
<?PHP
define('IN_MYBB', NULL);
define('THIS_SCRIPT', 'index.php');
// set the path to your forums directory here (without trailing slash)
$forumdir = "./";
// end editing
$change_dir = "./";
if(!@chdir($forumdir) && !empty($forumdir))
{
if(@is_dir($forumdir))
{
$change_dir = $forumdir;
}
else
{
die("\$forumdir is invalid!");
}
}
require_once $change_dir."/global.php";
require_once MYBB_ROOT."inc/class.MyBBIntegrator.php";;
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang);
$forums = array('2', '3');
$fields = 't.`tid`, t.`fid`, t.`subject`, t.`uid`, t.`username`, t.`dateline`, t.`views`, t.`replies`, t.`numratings`, t.`totalratings`';
$latest_threads = $MyBBI->getLatestThreads($forums, $fields, 5, true, true, false);
foreach ($latest_threads as $latest_thread)
{
echo $latest_thread['subject'].'<br />';
}
?>
** UPDATE ***
I was playing with the code trying to figure out the problem and finally found that it is an issue with the arrays, which are being treated as single integers.
This Works
$fields = 't.`tid`, t.`fid`, t.`subject`, t.`uid`, t.`username`, t.`dateline`, t.`views`, t.`replies`, t.`numratings`, t.`totalratings`';
$latest_threads = $MyBBI->getLatestThreads(2, $fields, 5, true, true, false);
foreach ($latest_threads as $latest_thread)
{
echo $latest_thread['subject'].'<br />';
}
This Does NOT Work
$forum_arr = array('2','4');
$fields = 't.`tid`, t.`fid`, t.`subject`, t.`uid`, t.`username`, t.`dateline`, t.`views`, t.`replies`, t.`numratings`, t.`totalratings`';
$latest_threads = $MyBBI->getLatestThreads($forum_arr, $fields, 5, true, true, false);
foreach ($latest_threads as $latest_thread)
{
echo $latest_thread['subject'].'<br />';
}
Ok, so what this tells us is that Arrays are not working.
If we open class.MyBBIntegrator.php and goto "function getLatestThreads"
we see that it is treating the value of $forum_id as a single value and not as an array.
Perhaps the Author can fix this up?