MyBB Community Forums

Full Version: Display latest threads in an external website page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello ppl,

I am back after a long period. so long that i have missed two releases of the mybb bulletin board.

now i was trying to move my website to another location and discovered that previous modification (not mods) is not working anymore.

in my website index page I applied a mod which should display latest posts in each forum.

define('IN_MYBB', NULL);
require_once 'mybb/global.php';
require_once 'class.MyBBIntegrator.php';
...

$latest_posts = $MyBBI->getLatestThreads(2, '*', 2, true);
foreach ($latest_posts as $latest_post)
{
	$mess_temp = "";
	$mess = str_word_count($latest_post['message'],1);
	$mess_l = count($mess);
	if($mess_l >= 31){
		for($i=0;$i<30;$i++){
			$mess_temp .= $mess[$i]." ";
			}	
		$mess_temp .= "...";
		}
	else{
		$mess_temp = $latest_post['message'];
		}
    $mess_forum .= "<fieldset><legend><b>".nome($latest_post['username'])."</b></legend><b> ".$latest_post['subject']."</b><br />".$mess_temp.'</fieldset><hr />';
} 
if(count($latest_posts) > 0) $mess_forum = "<img src='immagini/index_annunci.png'>".$mess_forum;

that was some source code found somewhere..

now..
it simply stopped working, probably due to my brand new installation from 1.4 to 1.6.
said that...
could you please help me out doing what I would like to?

simply take latest post in each forum and display their titles (with relative link to the forum) in the index page.


thank you! Big Grin

PS: the error i receive isthe following:
Quote:Fatal error: Call to a member function getLatestThreads() on a non-object in /membri/sessionkeeperol/index.php on line 68
Seeing as this is an issue with non-MyBB code I'll move this to code modifications. Looks like $MyBBI hasn't been initialised.
is there any update from this front?
I cannot make out which is the problem Sad
Well, in class.MyBBIntegrator.php, $MyBBI initiated...??
guys, I was just reporting my previous code used.

now i am looking for a 1.6 version substitute.
so simply if there's a link or a guide to do what I could with version 1.4 it will be appreciated and much more time saver Smile
I believe it's this: http://phpdave.com/MyBBIntegrator/

But anyway, the error you're getting is nothing to do with it changing from 1.4 to 1.6, that's what I'm trying to tell you. It's calling $MyBBI->getLatestThreads() but $MyBBI isn't an object, that's all. You just need to initiate the object and it'll work. It can't have worked if $MyBBI wasn't initiated before. This is in the documenation on the site:

$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);

You seem to be missing this, because it's saying $MyBBI isn't an object.
OKk, now that I have found the master website I could solve the issue.

i knew I was missing something, but realized was just a matter f missing class file.

thank you for your support.