Tutorial how to make other pages.

This mod will make it posible to specify permissions to all "special pages, like MEMBERLIST, PROFILE VIEW and so on.
The permissions support USERGROUP, making this tool very powerfull

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Tutorial how to make other pages.

Postby Niels on Mon 24. Nov, 2003 14:09

I have in the how-to included how to modify 2 pages (index.php and memberlist.php)
the memberlist page is included as this will be the usual way to modify other pages as well....

in order for you to modify other pages, I will try to explain witch steps are nessesary and how they are done...

TO ADD ANOTHER PAGE:
In the following I will make some of the text bold, where your attention is needed, proberbly since you will need to change modify that specific part.

First of all, there are 2 types of pages: original phpbb page and "others", others could be pages from a MOD or a page located outside the forum (e.g. your main page)

if the page are a non phpBB2 page or a MOD included page you should first of all inshure that it is defined in the file
Code: Select all
includes/constants.php


e.g. the memberlist.php is defined in this line of code
Code: Select all
define('PAGE_VIEWMEMBERS', -7);

please note the number -7, witch is a identifyer number, and should be uniqe
if you are adding a line of code like
define('PAGE_MYOTHERPAGE', -5678);

you should choise a number witch is not already in use in the file constants.php, and it MUST be a negative value


next step will be to add this new page to your DB

to add this new page into the DB, you will ned a DB tool like e.g. phpmyadmin - then run this SQL
INSERT INTO phpbb_forums (forum_id, cat_id, forum_name, forum_desc, forum_status )
VALUES ("THE_ID_FROM ABOVE","0", "THE_PAGE_NAME", "PAGE_DESCRIPTION", 1 )


the bold marked text need to be costomiced by you, in the eaxample from above where the new page got a id of -5678
Code: Select all
INSERT INTO phpbb_forums (forum_id, cat_id, forum_name, forum_desc, forum_status )
VALUES ("-5678","0", "My page", "My page permission control", 1 )



ok, now the page need to be modifyed, if it is MOD page for phpbb, I asume it have this first step already done, but look it up you will proberbly need to modify it slightly anywway.
if it is a new file or a external file you will shurely need this step.

in the top of the file include something like this
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, -5678);
init_userprefs($userdata);
//
// End session management
//

//
// Start auth check
//
$is_auth = array();
$is_auth = auth(AUTH_ALL, -5678, $userdata);

if( !$is_auth['auth_read'] )
{
message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
}
//
// End auth check
//


now your page is ready for using the extra permission auth control
anywhere you would like to make a auth control simply add a normal if
else
like this
if ($is_auth['auth_post'])
{
echo "You may post";
} else
{
echo "Sorry, you are not allowed to post";
}

any of the permission control you find in the ACP forum permission may be used, this include
auth_view, auth_read, auth_post, auth_delete, auth_mod auth_vote........you name it
Last edited by Niels on Tue 25. Nov, 2003 00:46, edited 2 times in total.
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Majorflam on Mon 24. Nov, 2003 19:13

Excellent, Neils.

I'm now watching this topic.

8O
Majorflam
Poster
Poster
 
Posts: 25
Joined: Tue 09. Sep, 2003 23:44

Postby Niels on Tue 25. Nov, 2003 00:47

I think I have explained it now, go give it a try
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Majorflam on Tue 25. Nov, 2003 01:41

It is now midnight my time. I will try this tomorrow.

Thanks Niels.
Majorflam
Poster
Poster
 
Posts: 25
Joined: Tue 09. Sep, 2003 23:44

Postby Majorflam on Wed 26. Nov, 2003 01:52

It worked a treat, Niels.... Thanks.
Majorflam
Poster
Poster
 
Posts: 25
Joined: Tue 09. Sep, 2003 23:44

Postby Niels on Mon 15. Dec, 2003 22:06

(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Skelp on Thu 11. Mar, 2004 04:39

Hey Niels.
I got the Extra Permissions MOD up and running but I'm having a probem with accessing the pages. I set my self up as a member with access to the member page. When I try to go to the page member.php when I am logged out I get the login page.. great so it's working so far.. but then when I enter my login informaiton and click enter I get a page that says "The forum you selected does not exist."

I'm thinking it might be the code I have put into the pages.... Here is the code I put in:

// standard session management
$userdata = session_pagestart($user_ip, PAGE_FSorder);
init_userprefs($userdata);

//
// End session management
//

//
// Start auth check
//
$is_auth = array();
$is_auth = auth(AUTH_ALL, $forum_id, $userdata);

if ( !$is_auth['auth_read'] || !$is_auth['auth_view'] )
{
if ( !$userdata['session_logged_in'] )
{
$redirect = POST_FORUM_URL . "=$forum_id" . ( ( isset($start) ) ? "&start=$start" : '' );
redirect(append_sid("login.$phpEx?redirect=viewforum.$phpEx&$redirect", true));
}
//
// The user is not authed to read this forum ...
//
$message = ( !$is_auth['auth_view'] ) ? $lang['Forum_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);

message_die(GENERAL_MESSAGE, $message);
}
//
// End of auth check
//

// Is user authed to view page
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_id);

// End Is user authed to view page



Do you see anything in there that may be causing this problem or could it be something else?
Skelp
Poster
Poster
 
Posts: 5
Joined: Thu 11. Mar, 2004 04:29

Postby Skelp on Fri 12. Mar, 2004 02:20

OK I figured it out. I can't use the forum_id tag. Had to use the actual id number.
Now I just need to make it so when users click the members button it directs them to the right page. I'm assuming I would need to use an if else statement or a case statement here using the member groub name as the identifier... am I correct?

Or maybe make three buttons in the header and have only the correct button visable depending on which group the member belongs to.... But I have no clue how to do this....
Skelp
Poster
Poster
 
Posts: 5
Joined: Thu 11. Mar, 2004 04:29

Next

Return to Extra permission [2.0.6/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron