Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[For 1.6] Last Poster Trophy On Postbit v1.01
#8
(2012-10-30, 03:31 PM)Leefish Wrote: Congratulations on the plugin - a really neat idea.

Thanks a lot Smile

(2012-10-30, 06:09 PM)Omar G. Wrote: This will awfully increase a query by post Sad To solve this find:
		// Find the last two posts in the 'Last Poster Wins' thread
		$last_post_query = $db->simple_select("posts", "uid", "tid=" . intval($mybb->settings['last_poster_setting2']), array("order_by" => 'dateline', "order_dir" => 'DESC', "limit" => 2));

		if ($db->num_rows($last_post_query) > 0)
		{
			// Get uid of the last two posters
			$last_post = $db->fetch_array($last_post_query);
			$next_to_last_post = $db->fetch_array($last_post_query);

Replace:
		// Find the last two posts in the 'Last Poster Wins' thread
		$last_post_query = $db->simple_select("posts", "uid", "tid=" . intval($mybb->settings['last_poster_setting2']), array("order_by" => 'dateline', "order_dir" => 'DESC', "limit" => 2));

		if ($db->num_rows($last_post_query) > 0)
		{
			// Get uid of the last two posters
			$last_post = $db->fetch_array($last_post_query);
			$next_to_last_post = $db->fetch_array($last_post_query);

Replace with:
		// Find the last two posts in the 'Last Poster Wins' thread
		if ($post['tid'] == (int)$mybb->settings['last_poster_setting2'])
		{
			// Get uid of the last two posters
			$last_post = $next_to_last_post = array('uid' => &$post['uid']);

First of all, thanks for taking the time to help me with my code. The only thing is my friend I do not understand how this code can work . . . this line:

$last_post = $next_to_last_post = array('uid' => &$post['uid']);

Doesn't seem to be looking up the last two posters in the LPW thread, but rather the last two posts in the current thread which isn't the same thing.

If I can do this without a query (or if I am wrong about the code) please let me know.

(2012-10-30, 06:09 PM)Omar G. Wrote: As you can see, you don't really need to query, good plugin and nice idea!

Thanks so much for that and for your advice that I will try to understand. Smile
[retired]
Reply


Messages In This Thread
Last Poster Trophy On Postbit v1.01 - by Wildcard - 2012-10-26, 02:43 AM
RE: Last Poster Trophy On Postbit v1.0 - by Wildcard - 2012-10-30, 07:32 PM

Forum Jump:


Users browsing this thread: 6 Guest(s)