MyBB Community Forums

Full Version: How to give permission for admin only to post html
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to give permission to admins and moderators only able to post html code,No other members can able to post it.
You'll need to do a couple things to do this. You will need to have HTML enabled in the forum. You will also need to alter the table mybb_usergroups. Run these SQL Queries to add the field for it:
ALTER TABLE `mybb_usergroups` ADD `canhtml` TINYINT( 1 ) NOT NULL DEFAULT '0'

UPDATE `dbname`.`mybb_usergroups` SET `canhtml` = '1' WHERE `mybb_usergroups`.`gid` =3;

UPDATE `dbname`.`mybb_usergroups` SET `canhtml` = '1' WHERE `mybb_usergroups`.`gid` =4;

UPDATE `dbname`.`mybb_usergroups` SET `canhtml` = '1' WHERE `mybb_usergroups`.`gid` =6;

Replace dbname with the name of your database.
Then go to the inc/class_parser.php file.
Find
 // Fix up HTML inside the code tags so it is clean
if($options['allow_html'] != 0)
					{
						$text[2] = $this->parse_html($text[2]);
					}
replace with
// Fix up HTML inside the code tags so it is clean
$mysqlquery="SELECT * FROM mybb_users WHERE usergroup='4' OR usergroup='6' OR usergroup='3'";
mysql_query($mysqlquery);
$allowedusers=mysql_query($mysqlquery);
foreach ($allowedusers as $posthtml)
{
$posthtml=1;
}

					if($options['allow_html'] != 0 && $posthtml==1)
					{
						$text[2] = $this->parse_html($text[2]);
					}
That should work.

(2011-01-31, 06:25 PM)dragonexpert Wrote: [ -> ]You'll need to do a couple things to do this. You will need to have HTML enabled in the forum. You will also need to alter the table mybb_usergroups. Run these SQL Queries to add the field for it:
ALTER TABLE `mybb_usergroups` ADD `canhtml` TINYINT( 1 ) NOT NULL DEFAULT '0'

UPDATE `dbname`.`mybb_usergroups` SET `canhtml` = '1' WHERE `mybb_usergroups`.`gid` =3;

UPDATE `dbname`.`mybb_usergroups` SET `canhtml` = '1' WHERE `mybb_usergroups`.`gid` =4;

UPDATE `dbname`.`mybb_usergroups` SET `canhtml` = '1' WHERE `mybb_usergroups`.`gid` =6;

Replace dbname with the name of your database.
Then go to the inc/class_parser.php file.
Find
 // Fix up HTML inside the code tags so it is clean
if($options['allow_html'] != 0)
					{
						$text[2] = $this->parse_html($text[2]);
					}
replace with
// Fix up HTML inside the code tags so it is clean
$mysqlquery="SELECT * FROM mybb_users WHERE usergroup='4' OR usergroup='6' OR usergroup='3'";
mysql_query($mysqlquery);
$allowedusers=mysql_query($mysqlquery);
foreach ($allowedusers as $posthtml)
{
$posthtml=1;
}

					if($options['allow_html'] != 0 && $posthtml==1)
					{
						$text[2] = $this->parse_html($text[2]);
					}
That should work.
Or -

You need a plugin. I'll go looking around and report back.
Here you go... Have to subscribe to get it though. I just got it and it works great!

http://www.mybbcentral.com/thread-1678.html
(2011-03-20, 04:57 AM)Jayfore Wrote: [ -> ]Here you go... Have to subscribe to get it though. I just got it and it works great!

http://www.mybbcentral.com/thread-1678.html

Here is another: http://yaldaram.com/showthread.php?tid=336