MyBB Community Forums

Full Version: How to show lastes post in Wordpress
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

How I can show lastes 20 new topics from forum on my blog in widget ?

Is this possible ?

br
I've just looked into this, and it seems the most straight-forward way (at the moment) without a custom widget is to install 2 different plugins - one for MyBB and the other for Wordpress. I've split the instructions into 2 parts:

MyBB Section Wrote:
  • Download and install the Recent Threads List plugin by Rogem
    Follow the instructions in the README by uploading new_thread.php to your root /forums folder, and the recentthreadsplugin.php into your /inc/plugins folder. Then activate it in your admin control panel.




  • Edit new_threads_external.php from the plugin.
    Using a good text editor (Notepad will work too) open up the file above and change the variable for $urltonewposts for your forum url. This is very straightforward as Rogem has made it very clear.



  • Copy the entire contents of new_threads_external.php
    EVERYTHING - including <?php and ?>. This will be needed for the next step.


Wordpress Section Wrote:
  • Download and install the Exec-php plugin by Sören Weber.
    Again please follow the instructions on the website/readme. The installation (at present) is to simply extract the entire folder into the /wp-content/plugins/ folder, and activating it in the plugins admin panel.



  • Click on Presentations -> Widgets in your admin panel.
    The plugin allows the execution of PHP code in widgets by utilising the text widget. This is enabled by default for anyone who can write articles for your wordpress blog.



  • Create a new text widget and insert the code from the last MyBB installation step above (ie. the code in new_threads_external.php) into the box.
    Exec-PHP runs PHP code by looking for the <?php and ?> brackets


This should give you the very bare minimum of displaying the latest threads from your MyBB forum on your Wordpress website as a widget.

If you want to :
  • Turn the plugin on/off
  • Change the Number of Threads
  • Set which forums threads should be displayed from
  • How the link opens (same page/new window) when a user clicks on a thread link

You can change the plugin settings within the MyBB Admin Panel under Board Settings -> Change -> Recent Threads Plugin Options

I've only tested this on a local install of Wordpress and MyBB (am working on a new WP theme) but please post if you have any problems. Smile
Hi,

thanks for anserw, I installed this like You write here bu a've got "There are no Threads available at this time." Why? What am I doing wrong?

OK now topics show. Where can I change charst? I'm useing polish letters...

Nowy - Posted by Albert on 12th January 2008 at 11:16 PM
Nowa strona i forum - wrażenia / zgłaszenia błędów - Posted by Jarek on 13th December 2007 at 02:35 PM
Co dodać? - Posted by Jarek on 20th February 2007 at 02:09 PM
Wigilia - Posted by Jarek on 24th December 2006 at 02:21 PM
problem z wejściem w profil - Posted by Ronaldinio on 18th December 2006 at 01:54 PM
Nowa odsłona - Posted by Jarek on 10th December 2006 at 05:09 PM
Migracja do CMS - Posted by Jarek on 28th November 2006 at 10:13 AM
pan reklamek - Posted by odeon2 on 14th November 2006 at 07:00 PM
Cisza wyborcza !! - Posted by Jarek on 12th November 2006 at 12:32 PM
Wysyłanie avatara - Posted by Jarek on 6th November 2006 at 09:23 PM
Tylko chwalić.... - Posted by odeon2 on 1st November 2006 at 09:57 AM
Design - Posted by Jarek on 13th October 2006 at 07:07 PM
Problem z odpowiedzią - Posted by andrus12 on 18th September 2006 at 03:12 PM
Nowy styl na forum - Posted by Jarek on 11th September 2006 at 08:12 AM
Czy tylko tak jest u mnie? - Posted by qrczak13 on 11th October 2006 at 10:58 PM

Where set to list only topics name, without who post it, where etc.?

br
Glad you've managed to get it working! It seems the file to edit is recentthreadsplugin.php

If you look at around Line 114, you should see something like this

		//ADD TEMPLATES
	$news_template_1 = array(
		"tid"		=> NULL,
		"title"		=> 'recentthreadsplugin_main',
		"template"	=> $db->escape_string('
<a href="{$forumpath}/showthread.php?tid={$news[\'tid\']}" target="$target">{$news[\'subject\']}</a> - Posted by  <strong>{$news[\'username\']}</strong> on  $date at $time<br />
'),
		"sid"		=> "-1",
		"version"	=> "1.0",
		"dateline"	=> time(),
	);

As you can see (at Line 119) there's a line that defines the variables to be displayed, including 'thread title', 'poster' and 'time', which you can edit to suit your site.
Hi,

I edited this file bu still don't work... See http://forum.antivir-polska.info/new_threads.php
Is it possible to show or attach a copy of your recentthreadsplugin.php here please?
flick Wrote:Is it possible to show or attach a copy of your recentthreadsplugin.php here please?

Ofcourse, please Smile
Sorry, my bad there. I had a look at it again, and it seems that the script actually writes the template into the database, so after editing recenthreadsplugin.php, you would have to de-activate and re-activate the plugin for the changes to come through.

Hope this helps Smile
Greate, it's work Smile

Where can I edit those link? Chcange link format, add bold etc.

br
Glad it's working Wink

If I've understood your question correctly, it's just a matter of editing recenthreadsplugin.php as before (the templates variable), and then (after uploading to your server) de-activating and re-activating the plugin so that it writes to the database.

For instance, the code I've used for my own site is
//ADD TEMPLATES
	$news_template_1 = array(
		"tid"		=> NULL,
		"title"		=> 'recentthreadsplugin_main',
		"template"	=> $db->escape_string('
<li><a href="{$forumpath}/showthread.php?tid={$news[\'tid\']}" title="{$news[\'subject\']} by {$news[\'username\']} on $date at $time">{$news[\'subject\']} <em>by&nbsp;</em><strong> {$news[\'username\']}</strong></a></li>'),
		"sid"		=> "-1",
		"version"	=> "1.0",
		"dateline"	=> time(),
	);

and the result is what you see below in the attachment.
Pages: 1 2