How to hook into the Showthread and remove
#1
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?
Reply
#2
No, your code doesn't make any sense.
http://docs.mybb.com/1.8/development/plu...-templates
Reply
#3
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
Reply
#4
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
Reply
#5
but that doesnt allow me to leanrn how to create a plugin grrrrrrr
Reply
#6
(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.
Reply
#7
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.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#8
(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
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)