Forum Template User-defined permissions

Discussion forum for MOD Writers regarding MOD Development.
User avatar
Stickygreen
Registered User
Posts: 179
Joined: Mon Oct 13, 2008 9:15 pm

Re: Forum Template User-defined permissions

Post by Stickygreen »

Code: Select all

<!-- IF (FORUM_ID == 9 or FORUM_ID == 5 or FORUM_ID == 48 or FORUM_ID == 53 or FORUM_ID == 35 or FORUM_ID == 6 or FORUM_ID == 7 or FORUM_ID == 2 or FORUM_ID == 8 or FORUM_ID == 14 or FORUM_ID == 59 and S_GROUP_225) -->
Everything works here but the last FORUM_ID == 59. What would I need to change here?

Basically I want something to show in a group of forums only if they are a member of a certain group.
User avatar
RMcGirr83
Former Team Member
Posts: 22071
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Forum Template User-defined permissions

Post by RMcGirr83 »

Code: Select all

<!-- IF S_GROUP_225 and (FORUM_ID == 9 or FORUM_ID == 5 or FORUM_ID == 48 or FORUM_ID == 53 or FORUM_ID == 35 or FORUM_ID == 6 or FORUM_ID == 7 or FORUM_ID == 2 or FORUM_ID == 8 or FORUM_ID == 14 or FORUM_ID == 59) -->
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
Stickygreen
Registered User
Posts: 179
Joined: Mon Oct 13, 2008 9:15 pm

Re: Forum Template User-defined permissions

Post by Stickygreen »

Thanks!
User avatar
noth
Registered User
Posts: 2528
Joined: Fri Jan 07, 2005 7:10 pm
Location: North Surrey

Re: Forum Template User-defined permissions

Post by noth »

I tried this in viewtopic <!-- IF S_GROUP_10 -->

<dd><strong>X Status:</strong> Red</dd>
<!-- ENDIF -->

but it shows everybody as group10, even guests

can this be applied to viewtopic? :P

(I want the poster to have a small line next to their post (X status) IF they are group10)
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Forum Template User-defined permissions

Post by 4_seven »

works only for group_id (string), not for poster_group_id (array).
what you need is a complete other code, which i'am also after, but not realized yet.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
PTownBandit
Registered User
Posts: 20
Joined: Mon Jul 30, 2007 5:09 pm
Location: Indiana

Re: Forum Template User-defined permissions

Post by PTownBandit »

Where do I need to look to verify my IDs? I see a lot of people referencing 2 and other single digit numbers. In my Groups table, all my group IDs are 4 digits.

When I use

Code: Select all

<!-- IF S_GROUP_1114 || S_GROUP_1115 --><!-- INCLUDE ads.html --><!-- ENDIF -->
Both of those groups see my ads.

But when I login with a test user that belongs to custom group I created 1124 (of course they are a Registered User also, 1115) they STILL see the ads instead of being hidden.

What am I doing wrong?
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 52794
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve

Re: Forum Template User-defined permissions

Post by stevemaury »

Your ids are 4 digits because you converted from version 2.
I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
User avatar
PTownBandit
Registered User
Posts: 20
Joined: Mon Jul 30, 2007 5:09 pm
Location: Indiana

Re: Forum Template User-defined permissions

Post by PTownBandit »

Thanks for the verification, I finally got it working the way I want. For some reason it works when I use the "IF not" and one Group ID instead of telling it to do it for 2 other groups.
Don Limito
Registered User
Posts: 6
Joined: Thu Jul 22, 2010 4:20 pm

Re: Forum Template User-defined permissions

Post by Don Limito »

IronJ221 wrote:This mod was nearly what I was working for, but not quite. What I need is to know when a certain group ID is present in a topic row.

For example:

Code: Select all

<!-- IF topicrow.S_GROUP_8 -->{topicrow.TOPIC_AUTHOR_FULL}<img src="admin-img.gif" /><!-- ELSE -->{topicrow.TOPIC_AUTHOR_FULL}<!-- ENDIF -->
Any Ideas?
I'm looking for the exact same thing, can anyone help us with this?
image45
Registered User
Posts: 168
Joined: Wed Feb 24, 2010 6:05 pm
Name: Robert

Re: Forum Template User-defined permissions

Post by image45 »

Just added the code to a new phpBB 3.0.9 installed board with no issues.
image45
Registered User
Posts: 168
Joined: Wed Feb 24, 2010 6:05 pm
Name: Robert

Re: Forum Template User-defined permissions

Post by image45 »

With regards to the switch like so for HTML markup

Code: Select all

<!-- IF not S_GROUP_2 -->your ad code<!-- ENDIF -->
If your create a new ACP module in php code only using no HTML template file in /adm/style/ directory, can you use the group switch within this ACP module php code to restrict access to code within an Options Legend at all please.

So for example if I wished to hide legend 1 from all admin group members in the acp, except for super admins in group 8, I would do this in HTML markup

'vars' => array
<!-- IF not S_GROUP_8 -->
// Options (global)
'legend1' => 'ACP_TOOL_LEGEND1',
'tool_enable' => array('lang' => 'ACP_TOOL_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
'tool_refresh_time' => array('lang' => 'ACP_TOOL_REFRESH_TIME', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false), <!-- ENDIF -->

However my code is in php not HTML so what would work in this example please?

Thank you ~ Robert
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 52794
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve

Re: Forum Template User-defined permissions

Post by stevemaury »

Use the php switches, like:

Code: Select all

<!-- PHP -->
echo "hello!";
<!-- ENDPHP -->
For more info, see http://area51.phpbb.com/phpBB/viewtopic ... 993#p79993

Notice you must enable the use of php in templates in the ACP, Security settings.

EDIT - sorry, I misunderstood what you wanted to do. Please disregard the above.
I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
image45
Registered User
Posts: 168
Joined: Wed Feb 24, 2010 6:05 pm
Name: Robert

Re: Forum Template User-defined permissions

Post by image45 »

stevemaury wrote:Use the php switches, like:

Code: Select all

<!-- PHP -->
echo "hello!";
<!-- ENDPHP -->
For more info, see http://area51.phpbb.com/phpBB/viewtopic ... 993#p79993

Notice you must enable the use of php in templates in the ACP, Security settings.

EDIT - sorry, I misunderstood what you wanted to do. Please disregard the above.
Got this to run/work now using below code,

$display_vars = array(
'title' => 'ACP_TOOL',
//'lang' => 'mods/info_acp_tool_lang',
'vars' => array()


global $user, $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
$groups = group_memberships(false,$user->data['user_id']);

$mygroups = array();

foreach($groups as $enum => $dgata)
{
$mygroups[] = (int)array_shift($dgata);
}
if(in_array(9, $mygroups))
{
php code for this group to view/use
}
legendxx
Registered User
Posts: 7
Joined: Fri Jan 04, 2013 1:55 pm

Re: Forum Template User-defined permissions

Post by legendxx »

can you guys tell me to get the rank chat in ajax chat here is the iamge
http://s7.postimage.org/h8w4npi5n/chatbox1.png

a forum member said that
I'm sure to get different colors for the ranks you will need to install a group MOD.
I've seen it somewhere on .com and it allows you to use <!-- IF S_GROUP_5 -->do this color<!-- ENDIF -->
I'm sure that can be used to use different classes for your group background colors.
so i came up here.. so could someone tell me how to do pls
image45
Registered User
Posts: 168
Joined: Wed Feb 24, 2010 6:05 pm
Name: Robert

Re: Forum Template User-defined permissions

Post by image45 »

legendxx wrote:can you guys tell me to get the rank chat in ajax chat here is the iamge
http://s7.postimage.org/h8w4npi5n/chatbox1.png

a forum member said that
I'm sure to get different colors for the ranks you will need to install a group MOD.
I've seen it somewhere on .com and it allows you to use <!-- IF S_GROUP_5 -->do this color<!-- ENDIF -->
I'm sure that can be used to use different classes for your group background colors.
so i came up here.. so could someone tell me how to do pls
With regards to the switch like so for HTML markup

Code: Select all

<!-- IF not S_GROUP_2 -->your ad code<!-- ENDIF -->
The switch will only control the markup that the browser loads and runs.

Return to “[3.0.x] MOD Writers Discussion”