miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

Enabling some BB codes only for registered members

Author Paul
Lead Developer
#1 | Posted: 15 Nov 2006 03:29 | Edited by: Paul 
Question: is there a way to disable certain bb codes for Anonymous posters as well?

Answer: of course, there is a way. Inside bb_codes.php file, in enCode() function, the following type conditions must be placed:

if($GLOBALS['user_id']!=0){

/* Only members BB code here for $pattern[] and $replacement[] */

}


If you want to disable certain buttons also, there is no way to do it easily except if you define each button's HTML in bb_plugins.php file with some kind of the following code:

if($user_id>0){
$buttonUrl=<<<out
<a href="JavaScript:paste_strinL(selektion, 4, '[url='+prompt('URL:','http://www.your-url-here.com')+']', '[/url]', '')" onmouseover="window.status='{$l_bb_url}'; return true" onmouseout="window.status=''; return true" onmousemove="pasteSel()"><img src="{$main_url}/img/button_url.gif" style="width:23px;height:22px" alt="{$l_bb_url}" /></a>&nbsp;
out;

$buttonImg=<<<out
<a href="JavaScript:paste_strinL('', 3, '[imgs='+prompt('URL:','http://www.url-to-your-image-here.com/image.jp g')+']', prompt('{$l_promptAlt}','')+'[/imgs]', '')" onmouseover="window.status='{$l_bb_image}'; return true" onmouseout="window.status=''; return true"><img src="{$main_url}/img/button_image.gif" style="width:23px;height:22px" alt="{$l_bb_image}" /></a>&nbsp;
out;

}

then paste {$buttonUrl} and {$buttonImg} (or other vars you may define) into templates/main_post_form.html file, instead of straight HTML provided.

Author Monk
Registered
#2 | Posted: 15 Nov 2006 15:27 
Thanks a lot Paul for the info, it works like a charm! ;-)

Author Monk
Registered
#3 | Posted: 16 Nov 2006 07:19 
Another quick question:

Is there a way to disable smilies for Anonymous posters as well? Or does the above code to disable BB codes work for smilies too.

Author Paul
Lead Developer
#4 | Posted: 16 Nov 2006 10:22 
Nope, above code won't work for smilies.

I think, for disabling smilies, you need to modify smilies addon code itself. Most probably the part for bb_plugins.php file... condition is the same.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications / Enabling some BB codes only for registered members Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB