MyBB Community Forums

Full Version: Switch last edition and creation date of posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

I want to inverse in all posts the last edition date and the creation date, if there is a last edition date.

For ex, on this post... instead of :
"Today, 01:16 PM (This post was last modified: Today 02:23 PM by Goose.)"

I want :
"Today 02:23 PM by Goose (This post was created on: Today, 01:16 PM)"

Is this possible, and easy to do ?

For my board, i'm on classic display, with creation date on top and edition date on bottom right inside brackets. I want to invert both.

This might be an SEO improvment. Google shows the creation date of a thread, and I want this to change during time if the 1st post is updated...


In situation, for this post : http://community.mybb.com/thread-108595.html

[Image: date_seo.png]

It is shown in Google with date 28 nov. 2011 (in french, 11-28-2011 in english), but last edition is 11-30-2011. So I hope that if I switch both info, Google will update post date to 11-30-2011 (30 nov. 2011 in french)

Ok, I've implemented my first plugin to do this.

It was easy, around 0h30 to get this work.

I've put a hook on postbit
$plugins->add_hook("postbit", "switchdate_start");

and main method is

function switchdate_start(&$post)
{
	global $postcounter, $templates;
	if ($postcounter == 1 && $post['author'] == 1 && $post['edituid'] != 0 && $post['edittime'] != 0)
	{			
		$savedDate = $post['editdate'];
		$savedTime = $post['edittime'];
		
		$post['editdate'] = $post['postdate'];
		$post['edittime'] = $post['posttime'];
		$post['editnote'] = "Message crée le : " . $post['postdate'] . " " . $post['posttime'] . " par"; // (Message crée le : 27-02-2013 18:44:16 par Goose.)
		eval("\$post['editedmsg'] = \"".$templates->get("postbit_editedby")."\";");
		
		$post['postdate'] = $savedDate;
		$post['posttime'] = $savedTime;
	}
}

It is not fully implemented, to be released it should use MyBB language and should be customizable (just want my one post to be "switched" that is why there is an if on author==1...), so I give it for free to anyone want to release a real plugin