Firefox PHP

Conditional New Topic Button

Posted by sarahk 
Conditional New Topic Button
March 04, 2006 08:07PM
In my templates I have

<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>

however I'd rather remove the button if the user can't post, or even give a little box of their permissions (see vB) so they know where they stand and what their options are. Obviously this isn't straightforward because of the Groups thing.

Is there a hack or a method for doing this?

Discuss Transit's SH20 Extension - Waterview
Re: Conditional New Topic Button
March 06, 2006 01:32PM
Try adding {If loggedin} before the part and {/IF} after in the template.

I'm not sure this is the very variable, but I guess so. If anything, have a look at the "login/logout" part, where it is used (I believe).

___
Polskie Centrum WebKomiksu
Re: Conditional New Topic Button
March 06, 2006 01:39PM
It's {IF LOGGEDIN} ... {/IF}. But only in case you have set all forums to only allow postings from authenticated users. Being logged in normally is not the thing that determines wheter you can post or now.

If the access scheme for the forums is more complicated, then you should use the access control functions that Phorum uses. Untested examples:

For posting a new topic
<?php if (phorum_user_access_allowed(PHORUM_USER_ALLOW_NEW_TOPIC)) { ?>
  <a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>
<?php } ?>
For replying to a topic
<?php if (phorum_user_access_allowed(PHORUM_USER_ALLOW_REPLY)) { ?>
  <a class="PhorumNavLink" href="{MESSAGES->reply_url}">{LANG->Reply}</a>
<?php } ?>


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Conditional New Topic Button
March 06, 2006 06:38PM
Perfect, just what I needed.

I'm on 5.08 so if it's not in that I'll upgrade ;)

Discuss Transit's SH20 Extension - Waterview
Sorry, only registered users may post in this forum.

Click here to login