PDA

View Full Version : Why does "Post New Thread" button appear for usergroup member's that cannot post?


vestaviascott
03-09-2011, 09:46 PM
I have a forum called "FAQ" in which I want to restrict all members except Admin from posting new threads.

So for example, members of "Registered Users" should be able to Reply to threads, but not create their own.

However, even though I've set up my forum permissions with "Can Post Threads: NO"

When I impersonate a user in the "registered users" usergroup, they still see the button "Post New Thread" even though they cannot post. Clicking the button takes them to a permission denied screen.

So its confusing the user. Why show the button if you already know they can't post???

So I'm wanting to remove that button for everyone but admin or the admin usergroup.

Thanks in advance for the help :-)

~ scott

BoostedK20
03-10-2011, 12:28 PM
IIRC, you can't remove the button. The best someone can do is click it and see the denied screen. You can write in the forum description for that specific one that "Only Admins can post new threads in this forum."

vestaviascott
03-10-2011, 01:11 PM
Thanks Boosted.

How about this:

Can I insert some vbulletin code on this template (I have no idea of the syntax, but something like this in PHP):

<?php
if (is_forum('FAQ') && !is_user_in('ADMINISTRATORS')) return;
else [INSERT BUTTON CODE];
end if;
?>

vestaviascott
03-21-2011, 05:03 PM
Anyone know the vb code I would need to do this check and in what php script it resides?

I'd really appreciate the help :-)

HMBeaty
03-21-2011, 05:06 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=231525" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=231525</a>

vestaviascott
03-21-2011, 05:15 PM
https://vborg.vbsupport.ru/showthread.php?t=231525

Thanks very much for the link. Its exactly what I was looking for.

Now if anyone happens to know the script that contains the "Post New Thread" button, I'm golden.

Lynne
03-21-2011, 05:30 PM
The other option is to write plugin (you would need to know a little bit of php though). The button has a condition around it based on $show['newthreadlink'], so you could write a plugin that basically sets that variable to false if you are in forumid x and if you are not an admin.

vestaviascott
03-21-2011, 05:40 PM
The other option is to write plugin (you would need to know a little bit of php though). The button has a condition around it based on $show['newthreadlink'], so you could write a plugin that basically sets that variable to false if you are in forumid x and if you are not an admin.

I'm cool with that too, and I'm fine with PHP code.

Would you happen to have a quick link reference to a tutorial on how to write a most basic VB plugin?

Otherwise, I'm fine with wrapping the appropriate script in the conditional check if I can determine which script holds the "Post New Thread" button. I'm starting my search with "forumdisplay.php" and working out from there.

Lynne
03-21-2011, 11:09 PM
I would download a real simply mod from the Add-Ons forum to see some basic plugin code.

if ($foruminfo['forumid'] == xx AND is_member_of($vbulletin->userinfo, y,z))
{
$show['newthreadlink'] = false;
}
Something like that. The variable names will always depend on the hook location you pick for your plugin. Pick a hook location, do a search in your files for the hook, then look at the variable names used right there to find out what is allowed.

Gator Bite
12-21-2011, 12:30 PM
Lynne,

Is there a way to limit this button based on a user's permissions to post. I have several forums where only members of certain groups can post, but others can read. Is there a way to enhance the "condition="$show['newthreadlink']" so that it simply doesn't display the 'New Thread' button based on a user's permission to post there?

Thanks in advance

Lynne
12-21-2011, 04:02 PM
If sure you can do that, however you will need to look in the code for the variable, or function, to use as I don't know it off the top of my head.

Gator Bite
12-23-2011, 03:34 PM
I figured it out and thought I would share for the benefit of the community. If you want to make it so your 'New Thread' button and links do not appear in forums where users do not have permission to post New Threads, you need to edit your 'FORUMDISPLAY' template. Find each instance of this:

<if condition="$show['newthreadlink']">


and replace it with this:

<if condition="$show['newthreadlink'] AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostnew'])">

There should be three instances. One for each button, top and bottom, and one for the drop list link.