MyBB Community Forums

Full Version: Thank You/Like System + Show First Post Support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am using the Thank You/Like System for my next update of the forum.

Also I am using this plugin to always show the first post on top of every page of the topic.

Unfortunately, the likes are not shown at the end of this pinned post.

Could I implement this myself? Any tips where to begin?
you must use a variable in this plugin first post template and in this plugin function that call first post template , before that fill thank you variable with all ways that you know . (this need PHP knowledge)
Hi, thank you!

Well, as far as I can see the first post plugin does not use a special template for showing the post.

First post template:

<div class="tfixed clear">
	<div class="thead"><strong>{$lang->first_post}</strong></div>
	<div id="posts_container">
		<div>{$posts}</div>
	</div>
</div>
<br />

That's all.

It is just using {$posts} with the requirement of only showing the first post.

That means the necessary variable is already there as it is in the post bit template: {$post['thankyoulike_data']}

But it is not showing any content, because the First Post plugin does not know it, I guess.

I have a little PHP knowledge, but it is difficult for me to follow the logic here.

Do I have to modify the First Post plugin, the thank you plugin or both?
(2024-04-07, 06:27 AM)skrilaxrev Wrote: [ -> ]Do I have to modify the First Post plugin, the thank you plugin or both?
Just the First Post plugin. Add this:
			if (function_exists('tyl_query_post_likes')) {
				global $g33k_pcache;

				$query = tyl_query_post_likes($post);

				while($t = $db->fetch_array($query))
				{
					$g33k_pcache[$t['pid']][] = $t;
				}
			}
			
to inc/plugins/show_first_post.php at line 170, that is, in function do_show_first_post(), in between:
			$post['visible'] = 1;
and
			// need to change global $postcounter and $page before build_postbit() so that the number of the post is always 1
			// after we build the post bit, we restore their original values
Man, thank you so much!

It is just working as it should be.
Glad to have helped!