Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

text that is visible only to a certain group

Asked Modified Viewed 1,393 times
P
pete2009
P
wiring guide,wiring diagrams,consumer unit,photos,movies.- www.aboutelectricity.co.uk
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 19 threads in the forums
  • Started this discussions
asked
Junior Member

Hi

I'm currently using bbcode members only which allows me to display certain texts only to users. I would like to modify the bbcode to be visible only to group of members, eg group called abc
Will the following modification work this way?

grouponly_bbcode_include.php
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: grouponly_bbcode_include.php
| Author: MarcusG
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
 
if ($group_name =abc) {
   $text = preg_replace('#\[grouponly\](.*?)\[/grouponly\]#si', '<br /><div><strong>'.$locale['bb_grouponly'].'</strong><br />\1</div>', $text);
} else {
   $text = preg_replace('#\[grouponly\](.*?)\[/grouponly\]#si', '<br /><span style=\'color:red;font-weight:bold\'>'.$locale['bb_grouponly_01'].'</span>', $text);
}
?>


membersonly_bbcode_include_var.php
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: grouponly_bbcode_include_var.php
| Author: MarcusG
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

$__BBCODE__[] =
array(
"description"      =>   $locale["bb_grouponly_description"],
"value"         =>   "grouponly",
"bbcode_start"      =>   "[grouponly]",
"bbcode_end"      =>   "[/grouponly]",
"usage"         =>   "[grouponly]".$locale["bb_grouponly_usage"]."[/grouponly]"
);
?>
pete2009 attached the following file:
grouponly.rar [No information available / 225 Downloads]
0 replies

1 post

D
DrunkeN
D
  • Member, joined since
  • Contributed 161 posts on the community forums.
  • Started 18 threads in the forums
answered
Member

If you still have use of this as I explain a bit fast to what this means

Now only the selected group can see and use this bb code.

Change group_id_here text to the ID that your group has
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: grouponly_bbcode_include.php
| Author: MarcusG
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
 
if (!checkgroup(group_id_here)) {
   $text = preg_replace('#\[grouponly\](.*?)\[/grouponly\]#si', '<br /><div><strong>'.$locale['bb_grouponly'].'</strong><br />\1</div>', $text);
} else {
   $text = preg_replace('#\[grouponly\](.*?)\[/grouponly\]#si', '<br /><span style=\'color:red;font-weight:bold\'>'.$locale['bb_grouponly_01'].'</span>', $text);
}
?>



Change group_id_here text to the ID that your group has
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: grouponly_bbcode_include_var.php
| Author: MarcusG
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }


if (!checkgroup(group_id_here)) {
$__BBCODE__[] =
array(
"description"      =>   $locale["bb_grouponly_description"],
"value"         =>   "grouponly",
"bbcode_start"      =>   "[grouponly]",
"bbcode_end"      =>   "[/grouponly]",
"usage"         =>   "[grouponly]".$locale["bb_grouponly_usage"]."[/grouponly]"
);
}
?>
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 1 post
  • Votes 0 votes
  • Topic users 2 members

2 participants

P
P
wiring guide,wiring diagrams,consumer unit,photos,movies.- www.aboutelectricity.co.uk
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 19 threads in the forums
  • Started this discussions
D
D
  • Member, joined since
  • Contributed 161 posts on the community forums.
  • Started 18 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet