MyBB Community Forums

Full Version: ShowFirstPost Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This plugin will allow you to show the first post of a thread in next pages too.

It is highly customizable:
  • Forum's ID:
    You can set the forum's ids where this plugin will be active, if you leave blank that will be active in all forums
  • Pages
    You can set the pages where to make first post visible, if you leave blank that will show on all pages

Both values are comma-separated.

But the key feature is the display mode Big Grin

You can set 2 display modes:
  • Top
  • Normal

But for me it is difficulty to explain, so you'll have to see with your eyes for understanding this feature. Wink

Also i know there was a similar plugin (i'm not able to find it) but that was a bit buggy, i couldn't enter in Admin Panel and that wasn't highly customizable.

If you want to port it for MyBB 1.4 look here
Thank you. This is a very nice plugin.
I will use in my forum.
Smile

I have a small problem:
[attachment=8998]

Where is template for this first post ? I want to edit template to put post content in right place and author (postbit) details in left place.
[attachment=8999]

Something like:
<table>
<tr><td>
postbit
</td><td>
message
</td></tr>
<table>

Where I can change this, please ?
It is the postbit template.

But this problem seems to be caused only by certain themes, i can't reproduce this.

I'm using FreshBlue theme and i don't reproduce this bug.
I use default theme... anyway... I will try to fix this...
Thank's again for this plugin.
Smile
Could you create this mod for v1.4x?
Porting this for MyBB 1.4

NOT TESTED!

Those are the necessary code edits, because now i'm not that interested in updating this plugin (i'm surprised by the fact that it gained interest). Smile

1. Find
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='showfirstpost_pages'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='showfirstpost_fids'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='showfirstpost_display'");
Replace with
	$db->delete_query("settings", "name IN ('showfirstpost_pages', 'showfirstpost_fids', 'showfirstpost_display')");

2. Find
	$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='showfirstpost'");
Replace with:
	$db->delete_query("settinggroups", "name='showfirstpost'");

3. Then delete all
TABLE_PREFIX.

4. Then find
FROM posts p 
And replace with:
" . TABLE_PREFIX . "posts p 
This part:

//Get the first post of a thread
function showfp_get_firstpost($tid)
{
	global $db;
	$query = $db->query("
		SELECT u.*, u.username AS userusername, p.*, f.*, eu.username AS editusername
		FROM posts p
		LEFT JOIN users u ON (u.uid=p.uid)
		LEFT JOIN userfields f ON (f.ufid=u.uid)
		LEFT JOIN users eu ON (eu.uid=p.edituid)
		WHERE tid='$tid'
		ORDER BY p.dateline ASC
		LIMIT 0,1
	");
	$post = $db->fetch_array($query);
	return $post;
}

Gives errors, it interprets posts table as <forumname>.posts
My mistake.

In that part find:
FROM posts p
Then replace it with
" . TABLE_PREFIX . "posts p
(2009-01-04, 02:20 PM)Shadow Player Wrote: [ -> ]This part:

//Get the first post of a thread
function showfp_get_firstpost($tid)
{
	global $db;
	$query = $db->query("
		SELECT u.*, u.username AS userusername, p.*, f.*, eu.username AS editusername
		FROM posts p
		LEFT JOIN users u ON (u.uid=p.uid)
		LEFT JOIN userfields f ON (f.ufid=u.uid)
		LEFT JOIN users eu ON (eu.uid=p.edituid)
		WHERE tid='$tid'
		ORDER BY p.dateline ASC
		LIMIT 0,1
	");
	$post = $db->fetch_array($query);
	return $post;
}

Gives errors, it interprets posts table as <forumname>.posts

Here is how its in my edited code - this works fine on my forum:
//Get the first post of a thread
function showfp_get_firstpost($tid)
{
	global $db;
	$query = $db->query("
		SELECT u.*, u.username AS userusername, p.*, f.*, eu.username AS editusername
		FROM ".TABLE_PREFIX."posts p
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
		LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
		LEFT JOIN ".TABLE_PREFIX."users eu ON (eu.uid=p.edituid)
		WHERE tid='$tid'
		ORDER BY p.dateline ASC
		LIMIT 0,1
	");
Please note that I DID leave the 'TABLE_PREFIX' as I found that it is necessary (even in version 1.4*)

Ori...
There is still one issue I noticed, and it's due to the fact that the first "real" post is supposed to have the title bar above, there is no separation between the first and the real first post.
Pages: 1 2