Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 5 Years, 4 Months, 4 Weeks ago Moderator Tools into a Button
#1
Solved: 5 Years, 4 Months, 4 Weeks ago Question 
I've made a moderator tool and I want to add it to my template next to the New Reply button at the top and bottom. I want to call it Junk. Say my mod tool id is 2, how do I do this? I believe it involves JavaScript but I have no idea.

Also, I want to have a button on profiles to close a user's account, which moves them to another group. I believe this, once again, requires javascript. How is it done? The users will be administrators with permission to change groups, I want it done via the button, not via ACP and then edit group.
#2
Solved: 5 Years, 4 Months, 4 Weeks ago
May be a interesting idea for a plugin. but if you are not interested on writing nor requesting it..

<form action="{$mybb->settings['bburl']}/moderation.php" method="post">
	<input type="hidden" name="modtype" value="thread" />
	<input type="hidden" name="tid" value="{$thread['tid']}" />
	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
	<input type="hidden" name="action" value="11" />
	<input type="submit" class="button" value="Run Custom Tool 11" />
</form>

You need to handle it via a post form. It should be a thread tool in my example above (modtype=thread).

Moved to a better fitted forum.
#3
Solved: 5 Years, 4 Months, 4 Weeks ago
(05-16-2014, 04:25 AM)Omar G. Wrote: May be a interesting idea for a plugin. but if you are not interested on writing nor requesting it..

<form action="{$mybb->settings['bburl']}/moderation.php" method="post">
	<input type="hidden" name="modtype" value="thread" />
	<input type="hidden" name="tid" value="{$thread['tid']}" />
	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
	<input type="hidden" name="action" value="11" />
	<input type="submit" class="button" value="Run Custom Tool 11" />
</form>

You need to handle it via a post form. It should be a thread tool in my example above (modtype=thread).

Moved to a better fitted forum.

Woops, I was interested in making a mod for it, yeah, but what it does is a template edit with that. Thank you for that. Any place I can actually find all of these post requests I can do?
#4
Solved: 5 Years, 4 Months, 4 Weeks ago
Also, any kind of post thing to change a user's group and also one to ban someone?
#5
Solved: 5 Years, 4 Months, 4 Weeks ago
Change "11" with the TID of your custom thread tool. And yes there may be post forms to change user groups or bam them, but those tend to be more dynamic.
#6
Solved: 5 Years, 4 Months, 4 Weeks ago
(05-17-2014, 04:09 PM)Omar G. Wrote: Change "11" with the TID of your custom thread tool. And yes there may be post forms to change user groups or bam them, but those tend to be more dynamic.

Yeah, I get that, but what are they? Alternatively, where can I get a list of these post forms?
#7
Solved: 5 Years, 4 Months, 4 Weeks ago
Well you create your own custom tools, you get the TID from the Custom Moderation Tools page in the ACP, only you know what they do :p

Sorry if I didn't understand your question clearly.
#8
Solved: 5 Years, 4 Months, 4 Weeks ago
(05-18-2014, 04:53 PM)Omar G. Wrote: Well you create your own custom tools, you get the TID from the Custom Moderation Tools page in the ACP, only you know what they do :p

Sorry if I didn't understand your question clearly.

No, I mean, a list of post forms I can do in MyBB, so I know what else I can do with a button. For example, I have a button on a profile that should "Kill" an account, basically changes the group of the user to Killed, idk what post form does that, so does MyBB list the post forms somewhere and the things that have to be specified with them?
#9
Solved: 5 Years, 4 Months, 4 Weeks ago
Oh no, it doesn't lists any form really, you need to figure out those yourself. I just checked the source code of this page to reply with the proper form you were asking for in your first post, I had to look for it myself Toungue

Go to the page where the action you are trying to duplicate with a button is found and try to figure out the form you would need.

For example, I don't think you can change user groups from the ModCP, but you can ban users (which perhaps is a enough for you):
<form action="{$mybb->settings['bburl']}/modcp.php" method="post">
	<input type="hidden" name="action" value="do_banuser" />
	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
	<input type="hidden" name="uid" value="{$thread['uid']}" />
	<input type="hidden" name="banreason" value="Spammer" />
	<input type="hidden" name="usergroup" value="7" />
	<input type="hidden" name="liftafter" value="---" />
	<input type="submit" class="button" name="updateban" value="Ban Thread Author Forever to Group 7" />
</form>

That code within the showthread* templates should work. You can even make it work for every post in the postbit* templates:
<form action="{$mybb->settings['bburl']}/modcp.php" method="post">
	<input type="hidden" name="action" value="do_banuser" />
	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
	<input type="hidden" name="uid" value="{$post['uid']}" />
	<input type="hidden" name="banreason" value="Spammer" />
	<input type="hidden" name="usergroup" value="7" />
	<input type="hidden" name="liftafter" value="---" />
	<input type="submit" class="button" name="updateban" value="Ban Post Author Forever to Group 7" />
</form>

Not that there are some downfalls about this. You cannot predict if the user is a moderator (can ban users) nor if the thread/post author can be banned (is a guest post) for example.

I get this code from the ./modcp.php?action=banuser&uid=X page.
#10
Solved: 5 Years, 4 Months, 4 Weeks ago
Thanks for that. Really should help me.

Regarding the predict part, I use Template Conditionals for that, it should hide it for anyone who can't access it.
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)