Forum Template User-defined permissions

Discussion forum for MOD Writers regarding MOD Development.
patr0
Registered User
Posts: 15
Joined: Wed Feb 03, 2010 10:30 pm

Re: Forum Template User-defined permissions

Post by patr0 »

Aha, oket, tnx bro, really tnx. :)
image45
Registered User
Posts: 168
Joined: Wed Feb 24, 2010 6:05 pm
Name: Robert

Re: Forum Template User-defined permissions

Post by image45 »

How much work would you need to do so you could add this kind of permissions in a template to the ACP permissions tab like so many of the excellent mods do for us when installed and run witht he umil files!

Thanks
image45
Registered User
Posts: 168
Joined: Wed Feb 24, 2010 6:05 pm
Name: Robert

Re: Forum Template User-defined permissions

Post by image45 »

soumik wrote:
BuryGnome wrote:So If i'm getting this right. I can use:

Code: Select all

<!-- IF S_GROUP_X || S_GROUP_Y -->some stuff here<!-- ENDIF --> 
and expand this line with || to more and more groups?
Yes.

Code: Select all

<!-- IF not (S_GROUP_5 || S_GROUP_8) -->some stuff here<!-- ENDIF -->
Another member said that it only works witht the brackets in place?

Is this true or is the below code correct please!

Code: Select all

<!-- IF S_GROUP_X || S_GROUP_Y -->some stuff here<!-- ENDIF --> 
Thanks ~ Robert
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53568
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Forum Template User-defined permissions

Post by Brf »

The parens are required because of the "not". It specifies that the not applies to the "or", not to the first condition alone.
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 »

also for "true"

Code: Select all

<!-- IF (S_GROUP_X || S_GROUP_Y) -->some stuff here<!-- ENDIF -->
as well as

Code: Select all

<!-- IF (S_GROUP_X or S_GROUP_Y) -->some stuff here<!-- 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 🍺
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53568
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Forum Template User-defined permissions

Post by Brf »

The parens are not required if you do not have the "not", as you can see from this code in prosilver's posting_editor.html:

Code: Select all

		<!-- IF S_EDIT_DRAFT || S_DISPLAY_REVIEW -->
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 »

Well yeah, it's a habit of mine to surround in parens.
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 🍺
image45
Registered User
Posts: 168
Joined: Wed Feb 24, 2010 6:05 pm
Name: Robert

Re: Forum Template User-defined permissions

Post by image45 »

Brf wrote:The parens are not required if you do not have the "not", as you can see from this code in prosilver's posting_editor.html:

Code: Select all

		<!-- IF S_EDIT_DRAFT || S_DISPLAY_REVIEW -->
Yes I see now, thank you so much for running through all the examples above :D
RMcGirr83 wrote:Well yeah, it's a habit of mine to surround in parens.
So its a much more safe way to work if you use parens when not needed rather than miss them out/off when required in a template HTML code? I don't mean pop parens in all areas as you go, only as shown in the examples raised above by Brf.
msgerbs
Registered User
Posts: 29
Joined: Sun Jul 18, 2010 6:16 am

Re: Forum Template User-defined permissions

Post by msgerbs »

I tried this, and it seems to work, but I'm getting errors at the top of the page as follows:

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4518: Cannot modify header information - headers already sent by (output started at /material.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4520: Cannot modify header information - headers already sent by (output started at /material.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4521: Cannot modify header information - headers already sent by (output started at /material.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4522: Cannot modify header information - headers already sent by (output started at /material.php:1)
I'm really not very good with phpbb, what did I do wrong? The code for material.php is as follows:

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    // $ptmc_member  = group_memberships(8,$user->data['user_id']);

    if (S_GROUP_8 || S_GROUP_5) {

    page_header('PTMC Material Database');

    $template->set_filenames(array(
        'body' => 'material_body.php',
    ));
    }

    else {

    page_header('Access Denied');

    print('Access Denied');

    $template->set_filenames(array(
    'body' => 'index_body.html',
    ));

    }

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
    
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 »

More than likely you have a blank space at the beginning of your php file. I don't know what editor you are using to edit the files with, but you should be using a strict text editor like notepad++ to edit the files with.
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
Brf
Support Team Member
Support Team Member
Posts: 53568
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Forum Template User-defined permissions

Post by Brf »

You have four spaces before the<?php. That needs to start in the first column.
When you use Firefox to Select-All on a code block, it adds fours spaces at the beginning of each line.
msgerbs
Registered User
Posts: 29
Joined: Sun Jul 18, 2010 6:16 am

Re: Forum Template User-defined permissions

Post by msgerbs »

Thanks. I was using normal wordpad to edit it.

Removing the spaces fixed the problem. Would notepad++ or similar automatically remove such mistakes?
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: Forum Template User-defined permissions

Post by Oyabun1 »

Notepad++ won't add extraneous characters to files.

It is usually recommended to have whatever text editor you are using set to encode files as UTF8 without BOM, some editors like Windows Notepad are not capable of doing that. Instead use Notepad++ or any of the editors recommended here, Text editors.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
trickoff
Registered User
Posts: 513
Joined: Mon Jan 07, 2008 12:23 am

Re: Forum Template User-defined permissions

Post by trickoff »

Sweet topic =)

I'm looking for almost the same thing as you've been discussing here. What I'm looking for is a if-statement that displays something on a users profile if that user belongs to a certain group, not depending on the groups that YOU belong to, but the groups that the user you are viewing belongs to.

ex:
UserA is viewing UserB's profile, and if UserB belongs to a certain group some text will be displayed on his profile.

Is this possible?
thanks
IronJ221
Registered User
Posts: 68
Joined: Sat Nov 23, 2002 11:09 pm
Location: USA

Re: Forum Template User-defined permissions

Post by IronJ221 »

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?
Image

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