• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Latest posts on your website

Yeah I guess, you're doing awesome work though. This addon is very useful :)
 
The issue with checking permissions with this code, is that this is a completely external interface to XenForo, so your user account and permissions are not available. I suppose if it was on the same domain you could share cookies, but at that point it would be far less of a pain to just integrate the XenForo user/session systems into your external code.
 
The issue with checking permissions with this code, is that this is a completely external interface to XenForo, so your user account and permissions are not available. I suppose if it was on the same domain you could share cookies, but at that point it would be far less of a pain to just integrate the XenForo user/session systems into your external code.

This is something i am doing for my website where i use similar code to what's posted, once i am finished and i understand it - i will give a go at updating this little script, but for now it works fine for people not hiding forums.
 
Thanks.. I probably will. I don't know if you saw this thread but I got the idea after reading this one. I thought it would be good to have "most liked" as well as "Latest"
 
I don't belive this will work for other users;)
they don't have your geekpoint_symfony class
PHP:
GeekPoint_Symfony::initializeXenforo($forum_directory, $startTime);
 
// OT

If you've initialized the xenforo framework, use its database object to perform all your queries. Also, you can use the XenForo_Link class to construct links for any resource inside xenforo. (prepending the route name with ":full" will create absolute links). And make sure you are escaping the thread titles!

PHP:
$query   = "SELECT [...]";
$threads = XenForo_Application::get('db')->fetchAll($query);

foreach ($threads as $thread)
{
	// The absolute thread url is constructed for you
	$threadUrl = XenForo_Link::buildPublicLink('full:threads', $thread);

	// Trimmed and properly escaped
	$threadTitle = XenForo_Template_Helper_Core::helperWordTrim($thread['title'], 50);
}
 
Undefined variable: config /***/lastpost_xf2.php:28
Line 28:
Code:
mysql_connect($config['db']['host'], $config['db']['username'], $config['db']['password']);
 
I thought that I need nothing else as code from first post :)
Can you provide code example for config?
 
Second version of the code is not working. I've used the one that another user pointed out, where you have to input the db details. That one is working.
I have another problem - it doesn't display any other characters, besides English ones, but I guess this won't be solved, since author is ignoring this thread.
 
Back
Top Bottom