miniBB ®

miniBB

®
Support Forums
  
 · Start · Sign in · Register · Search · Statistics · File Bank · Manual ·
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Enabling some BB codes only for registered members

 
Author Paul
Lead Lead Developer
#1 · Posted: 15 Nov 2006 03:29Reply Quote
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="https://www.minibb.com/forums/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="https://www.minibb.com/forums/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
Partaker
#2 · Posted: 15 Nov 2006 15:27Reply Quote
Thanks a lot Paul for the info, it works like a charm! ;-)

Author Monk
Partaker
#3 · Posted: 16 Nov 2006 07:19Reply Quote
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 Lead Developer
#4 · Posted: 16 Nov 2006 10:22Reply Quote
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
 Share Topic's Link

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

BB code for the Bold StyleBB code for the Italic StyleBB Code for the PictureBB code for the URLUpload a File

  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Try the File and Picture Attachments add-on: extend your miniBB-forums, attaching images and files.