Forum Template User-defined permissions

Discussion forum for MOD Writers regarding MOD Development.
amplifiedshock
Registered User
Posts: 51
Joined: Fri Jan 04, 2008 1:28 pm

Re: Forum Template User-defined permissions

Post by amplifiedshock »

Oh right sorry about that, I must have used the wrong id.

One more question:

<!-- IF not S_GROUP_5 || S_GROUP_8 -->some stuff here<!-- ENDIF -->

Doesn't seem to work for group 8, am I doing something wrong here?

EDIT: Nevermind! Forgot the brackets


<!-- IF not (S_GROUP_5 || S_GROUP_8) -->some stuff here<!-- ENDIF -->
forumadmin2069
Registered User
Posts: 7
Joined: Fri Jan 07, 2011 12:15 am

Re: Forum Template User-defined permissions

Post by forumadmin2069 »

Hi, I hope my question is relevant to this topic. Could someone walk me through adding a forum-wide ad, which would be displayed to everyone, but exclude a certain group (or groups). I know there's a mod for this, but all I need is this very basic functionality, and I rather not use a mod, to avoid complications with updating in the future. Thanks a lot!
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 »

Open includes/functions.php

FIND

Code: Select all

   // The following assigns all _common_ variables that may be used at any point in a template.
BEFORE, ADD

Code: Select all

    if ( !function_exists('group_memberships') )
    {
        include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
    }
    $groups = group_memberships(false,$user->data['user_id']);
    foreach ($groups as $grouprec)
    {
        $template->assign_vars(array(
        'S_GROUP_' . $grouprec['group_id'] => true
        ));
    }
then use the switch like so

Code: Select all

<!-- IF not S_GROUP_2 -->your ad code<!-- ENDIF -->
I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
patr0
Registered User
Posts: 15
Joined: Wed Feb 03, 2010 10:30 pm

Re: Forum Template User-defined permissions

Post by patr0 »

Hi to all.

I'm using 3.0.8 version and i have a problem with functions.php, it seems that the code is not good. :/

Parse error: parse error in ...includes\functions.php on line 4381

Code: Select all

	// Send a proper content-language to the output
	$user_lang = $user->lang['USER_LANG'];
	if (strpos($user_lang, '-x-') !== false)
	{
		$user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
	}
#4381    if ( !function_exists('group_memberships') )
    {
        include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
    }
    $groups = group_memberships(false,$user->data['user_id']);
    foreach ($groups as $grouprec)
    {
        $template->assign_vars(array(
        'S_GROUP_' . $grouprec['group_id'] => true
        ));
    }

	// The following assigns all _common_ variables that may be used at any point in a template.
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 »

Try putting it in the place I said to put it.
I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
patr0
Registered User
Posts: 15
Joined: Wed Feb 03, 2010 10:30 pm

Re: Forum Template User-defined permissions

Post by patr0 »

I put it where you said, before:

Code: Select all

   // The following assigns all _common_ variables that may be used at any point in a template.
User avatar
RMcGirr83
Former Team Member
Posts: 22073
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Forum Template User-defined permissions

Post by RMcGirr83 »

Try moving the code to just above this line a few lines down

Code: Select all

	// application/xhtml+xml not used because of IE
	header('Content-type: text/html; charset=UTF-8');
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 🍺
patr0
Registered User
Posts: 15
Joined: Wed Feb 03, 2010 10:30 pm

Re: Forum Template User-defined permissions

Post by patr0 »

Again. :/

Parse error: parse error in ...\includes\functions.php on line 4509

Code: Select all

#4509    if ( !function_exists('group_memberships') )
    {
        include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
    }
    $groups = group_memberships(false,$user->data['user_id']);
    foreach ($groups as $grouprec)
    {
        $template->assign_vars(array(
        'S_GROUP_' . $grouprec['group_id'] => true
        ));
    }

	// application/xhtml+xml not used because of IE
	header('Content-type: text/html; charset=UTF-8');
User avatar
RMcGirr83
Former Team Member
Posts: 22073
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Forum Template User-defined permissions

Post by RMcGirr83 »

Is that the full error you are getting?
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 🍺
patr0
Registered User
Posts: 15
Joined: Wed Feb 03, 2010 10:30 pm

Re: Forum Template User-defined permissions

Post by patr0 »

Yes.

@edit

Code: Select all

http://rapidshare.com/files/444086644/functions.rar
Last edited by patr0 on Sun Jan 23, 2011 10:08 am, edited 2 times in total.
User avatar
RMcGirr83
Former Team Member
Posts: 22073
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Forum Template User-defined permissions

Post by RMcGirr83 »

Post up your entire includes/functions.php file please (zip it and attach it or provide a link to it).
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 🍺
patr0
Registered User
Posts: 15
Joined: Wed Feb 03, 2010 10:30 pm

Re: Forum Template User-defined permissions

Post by patr0 »

Code: Select all

http://rapidshare.com/files/444086644/functions.rar
User avatar
RMcGirr83
Former Team Member
Posts: 22073
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Forum Template User-defined permissions

Post by RMcGirr83 »

Not sure what you are using for a text editor, but try this file instead

http://rmcgirr83.org/mods/functions.zip
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 🍺
patr0
Registered User
Posts: 15
Joined: Wed Feb 03, 2010 10:30 pm

Re: Forum Template User-defined permissions

Post by patr0 »

Heh, it works, tnx bro. :)

Btw here <!-- IF not S_GROUP_2 -->your ad code<!-- ENDIF --> instead of 2 typing the id of group wich can see the code?
User avatar
RMcGirr83
Former Team Member
Posts: 22073
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Forum Template User-defined permissions

Post by RMcGirr83 »

patr0 wrote:Heh, it works, tnx bro. :)

Btw here <!-- IF not S_GROUP_2 -->your ad code<!-- ENDIF --> instead of 2 typing the id of group wich can see the code?
Not sure what you mean but if you want those in group 2 to see the code it would be

Code: Select all

<!-- IF S_GROUP_2 -->your ad code<!-- ENDIF -->
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 🍺

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