Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 New Thread/Reply Button Depends On Permission
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
New Thread/Reply Button Depends On Permission
Required: Template Conditionals or PHP in Templates / Complex Templates plugin.

This will hide the New Thread button automatically when a user doesn't have permission to create a new thread in a forum.

forumdisplay_newthread:

HTML Code
<if $fpermissions['canpostthreads'] == 1 then>
<a href="newthread.php?fid={$fid}"><img src="{$theme['imglangdir']}/newthread.gif" alt="{$lang->post_thread}" title="{$lang->post_thread}" /></a>
</if>


This will hide the New Reply button automatically when a user doesn't have permission to post a new reply in a thread.

showthread_newreply:

HTML Code
<if $forumpermissions['canpostreplys'] == 1 then>
<a href="newreply.php?tid={$tid}"><img src="{$theme['imglangdir']}/newreply.gif" alt="{$lang->post_reply_img}" title="{$lang->post_reply_img}" /></a>&nbsp;
</if>


The same conditional if we want to hide the Reply button in postbit:
postbit_quote template:

HTML Code
<if $forumpermissions['canpostreplys'] == 1 then>
<a href="newreply.php?tid={$tid}&amp;pid={$post['pid']}"><img src="{$theme['imglangdir']}/postbit_quote.gif" alt="{$lang->postbit_quote}" title="{$lang->postbit_quote}" /></a>
</if>


We can use a <else> condition for users who don't have permission.
For example, we can use a button to link to our registration page, and use a different image:

HTML Code
<if $fpermissions['canpostthreads'] == 1 then>
<a href="newthread.php?fid={$fid}"><img src="{$theme['imglangdir']}/newthread.gif" alt="{$lang->post_thread}" title="{$lang->post_thread}" /></a>
<else>
<a href="{$mybb->settings['bburl']}/member.php?action=register"><img src="{$theme['imglangdir']}/register.gif" alt="Register" title="Only member can post a thread in this forum. Please register first" /></a>
</if>


Maybe it is useless, but, I just want to share it Biggrin
And please tell me if I had made a mistake with the code Biggrin


(This post was last modified: 12-07-2010 05:44 AM by RateU.)
12-07-2010 05:16 AM
Find all posts by this user Quote this message in a reply
TriTop Offline
Member
***
Posts: 53
Joined: Apr 2008
Post: #2
RE: New Thread/Reply Button Depends On Permission
Hey RateU,
your post inspired me for the attached plugin.


Attached File(s)
.php  buttoncheck.php (Size: 1.13 KB / Downloads: 532)
12-07-2010 06:09 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #3
RE: New Thread/Reply Button Depends On Permission
Nice tips and work Smile

My Blog
12-07-2010 08:14 AM
Find all posts by this user Quote this message in a reply
Skiilz Offline
Member
***
Posts: 198
Joined: Nov 2010
Post: #4
RE: New Thread/Reply Button Depends On Permission
Thank you RateU. Great info.

[Image: 468x602b.png]
12-07-2010 09:21 AM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #5
RE: New Thread/Reply Button Depends On Permission
Thanks RateU.

[Image: logo.png]

[Image: twitter.png]
12-07-2010 10:14 AM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #6
RE: New Thread/Reply Button Depends On Permission
thanks rateu
12-07-2010 12:06 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #7
RE: New Thread/Reply Button Depends On Permission
Really cool, thanks RateU.


[Image: leelink.gif]
MYBB1.6 & XThreads
12-07-2010 04:28 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #8
RE: New Thread/Reply Button Depends On Permission
Thanks Biggrin
And thanks to TriTop for sharing Smile

12-08-2010 02:46 AM
Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #9
RE: New Thread/Reply Button Depends On Permission
lol. i'm noob in making plugins. otherwise i would have shared some cool plugins.
12-08-2010 03:42 AM
Find all posts by this user Quote this message in a reply
TriTop Offline
Member
***
Posts: 53
Joined: Apr 2008
Post: #10
RE: New Thread/Reply Button Depends On Permission
The credit belongs to you RateU. You be bubbling over with ideas. Glad to give back something to this great community. Smile
12-08-2010 04:04 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: