MyBB Community Forums

Full Version: How to hook into the Showthread and remove
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to hook into the Showthread and remove the post bit?

$plugins->add_hook("showthread", "myPlugin_showthread");



if some setting is met, how can i remove the 
{$posts}


{$first_post}{$posts}


Can someone move it to the plugins?

function myPlugin_showthread(&$posts)
{}

is this correct?
No, your code doesn't make any sense.
http://docs.mybb.com/1.8/development/plu...-templates
What I need to do is

Check for usergroups, where only admins and moderators can see replies

If is_user(3,4,6) {posts}


So  how do pass variable to template
Nb I am on mobile
Well, you can use the is_member() function to check groups and the is_moderator() function to check whether the user is moderator on X forum or globally.
https://github.com/mybb/mybb/blob/featur....php#L6934
https://github.com/mybb/mybb/blob/featur....php#L6934
but that doesnt allow me to leanrn how to create a plugin grrrrrrr
(2015-10-11, 06:19 AM)expat Wrote: [ -> ]but that doesnt allow me to leanrn how to create a plugin grrrrrrr

And what can we do about that? I'm not sure what you're trying to say... Only you can control and broaden your own knowledge.

First you need to learn PHP, at least basics: https://secure.php.net/manual/
MySQL too: http://dev.mysql.com/doc/
And basics such as HTML/CSS.

Then you can start writing basic plugins: http://docs.mybb.com/
You can also check other plugins/core to learn how something works in MyBB.
First of all $first_post is not a MyBB variable, it is a xThreads one, is not it?

You need to hook at showthread_start/end for whatever you are trying to do.

Check my plugin for an example.
https://github.com/Sama34/OUGC-Guests-Se..._gsofp.php

Although my plugin does use a dirty method I wouldn't really recommend.
(2015-10-12, 06:25 AM)Omar G. Wrote: [ -> ]First of all $first_post is not a MyBB variable, it is a xThreads one, is not it?

You need to hook at showthread_start/end for whatever you are trying to do.

Check my plugin for an example.
https://github.com/Sama34/OUGC-Guests-Se..._gsofp.php

Although my plugin does use a dirty method I wouldn't really recommend.

hey thanks, i am actually decoding your plugins just to learn how to do a plugin Toungue