Test acount mod
Posted: Sun Feb 04, 2007 4:09 pm
i've written a test acount mod for integramod or every other board that uses PCP
the test acount cannot post messages, or update the profile.
the test acount cannot post messages, or update the profile.
- Code: Select all
################################################################ MOD Title]telenet[dot]be>## MOD De.scription:## This mod allows you the possibility to create a "test acount" by## giving him restricted access rights. Test member cannot modifies his## profile (like the password) and you can choose from the ACP if he can## post in the forums.## Userfull for hacks authors who want to offer a demo of their hacks.#### MOD Version: 0.1.0#### Installation Level: Easy## Installation Time: 20 Minutes## Files To Edit: [9]## includes/page_header.php## language/lang_english/lang_admin.php## language/lang_english/lang_main.php## admin/admin_board.php## admin/admin_users.php## profile.php## templates/subsilver/overall_header.tpl## templates/subsilver/admin/user_edit_body.tpl## templates/subSilver/admin/board_config_body.tpl#### Included Files: N/A [0]################################################################## Author Notes:#### :mrgreen:#################################################################### MOD History:#### 2007-02-02 - Version 0.1.0## - First English version released.################################################################## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD################################################################-----[ SQL ]------------------------------------------#INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_testor_post', '1'); ##-----[ SQL ]------------------------------------------#ALTER TABLE phpbb_users ADD user_test TINYINT( 1 ) DEFAULT '0' NOT NULL ; ##-----[ OPEN ]------------------------------------------# includes/page_header.php ##-----[ FIND ]------------------------------------------# $template->assign_block_vars('switch_user_logged_in', array()); ##-----[ AFTER, ADD ]------------------------------------------# // Tester Only View Mod if ( $userdata['user_test'] ) { $template->assign_block_vars('switch_tester_view_only', array()); }// Tester Only View Mod ##-----[ OPEN ]-----#language/lang_english/lang_admin.php ##-----[ FIND ]-----#//// That's all Folks!// ------------------------------------------------- ##-----[ BEFORE, ADD ]-----#$lang['Testor_post_activate'] = 'Authorize the test member to post in the forums';$lang['User_testor_activate'] = 'Is this user a test login?'; ##-----[ OPEN ]-----#language/lang_english/lang_main.php ##-----[ FIND ]-----#//// That's all Folks!// ------------------------------------------------- ##-----[ BEFORE, ADD ]-----#$lang['login_test_forbidden'] = 'You cannot modify your profile as tester!';$lang['login_test_post_forbidden'] = 'You cannot post a message as tester!'; ##-----[ OPEN ]-----#admin/admin_users.php ##-----[ FIND ]------------------------------------------# $user_allowpm = ( !empty($HTTP_POST_VARS['user_allowpm']) ) ? intval( $HTTP_POST_VARS['user_allowpm'] ) : 0; ##-----[ AFTER, ADD ]------------------------------------------# $user_test = ( !empty($HTTP_POST_VARS['user_test']) ) ? intval( $HTTP_POST_VARS['user_test'] ) : 0; ##-----[ FIND ]------------------------------------------# SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("'", "''", $email) . "', user_icq = '" . str_replace("'", "''", $icq) . "', user_website = '" . str_replace("'", "''", $website) . "', user_occ = '" . str_replace("'", "''", $occupation) . "', user_from = '" . str_replace("'", "''", $location) . "', user_interests = '" . str_replace("'", "''", $interests) . "', user_sig = '" . str_replace("'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("'", "''", $aim) . "', user_yim = '" . str_replace("'", "''", $yim) . "', user_msnm = '" . str_replace("'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . " ##-----[ IN-LINE FIND ]------------------------------------------#, user_allow_pm = $user_allowpm ##-----[ IN-LINE AFTER, ADD ]------------------------------------------#, user_test = $user_test ##-----[ IN-LINE FIND ]------------------------------------------# $user_allowpm = $this_userdata['user_allow_pm']; ##-----[ IN-LINE AFTER, ADD ]------------------------------------------# $user_test = $this_userdata['user_test']; ##-----[ FIND ]------------------------------------------# $s_hidden_fields .= '<input>'; ##-----[ AFTER, ADD ]------------------------------------------# $s_hidden_fields .= '<input>'; ##-----[ FIND ]------------------------------------------# 'ALLOW_PM_YES' => ($user_allowpm) ? 'checked="checked"' : '', 'ALLOW_PM_NO' => (!$user_allowpm) ? 'checked="checked"' : '', ##-----[ AFTER, ADD ]------------------------------------------# 'USER_TEST_YES' => ($user_test) ? 'checked="checked"' : '', 'USER_TEST_NO' => (!$user_test) ? 'checked="checked"' : '', ##-----[ FIND ]------------------------------------------# 'L_ALLOW_PM' => $lang['User_allowpm'], ##-----[ AFTER, ADD ]------------------------------------------# 'L_TESTOR' => $lang['User_testor_activate'], ##-----[ OPEN ]-----#admin/admin_board.php ##-----[ FIND ]-----#$namechange_yes = ( $new['allow_namechange'] ) ? "checked="checked"" : "";$namechange_no = ( !$new['allow_namechange'] ) ? "checked="checked"" : ""; ##-----[ AFTER, ADD ]-----# $testor_post_yes = ( $new['allow_testor_post'] ) ? "checked="checked"" : "";$testor_post_no = ( !$new['allow_testor_post'] ) ? "checked="checked"" : ""; ##-----[ FIND ]-----# "L_MAX_SIG_LENGTH_EXPLAIN" => $lang['Max_sig_length_explain'], "L_ALLOW_NAME_CHANGE" => $lang['Allow_name_change'], ##-----[ AFTER, ADD ]-----# "L_ALLOW_TEST_POST" => $lang['Testor_post_activate'], ##-----[ FIND ]-----# "NAMECHANGE_YES" => $namechange_yes, "NAMECHANGE_NO" => $namechange_no, ##-----[ AFTER, ADD ]-----# "TESTOR_POST_YES" => $testor_post_yes, "TESTOR_POST_NO" => $testor_post_no, ##-----[ OPEN ]-----#profile.php ##-----[ FIND ]-----#if ( !$userdata['session_logged_in'] ){ if ($mode != 'profil' || $sub != 'profile_prefer' || $mod !=0) { if ($view_user_id == ANONYMOUS) { redirect(append_sid("login.$phpEx?redirect=profile.$phpEx?mode=$mode&sub=$sub&mod=$mod&msub=$msub", true)); } else if ($mode != 'activate') { redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile&" . POST_USERS_URL . "=$view_user_id", true)); $mode = 'viewprofile'; } }}##-----[ AFTER, ADD ]------------------------------------------#if ( $userdata['user_test'] && $mode == 'editprofile' || $userdata['user_test'] && $mode == 'profil' ){ redirect(append_sid("profile.$phpEx?mode=viewprofile&u=$view_user_id", true));} ##-----[ OPEN ]-----#posting.php ##-----[ FIND ]-----#//// End session management// ##-----[ AFTER, ADD ]------------------------------------------#if ( !$board_config['allow_testor_post'] && $userdata['user_test']){ message_die(GENERAL_MESSAGE, $lang['login_test_post_forbidden'] );} ##-----[ OPEN ]-----#templates/subsilver/overall_header.tpl ##-----[ FIND ]------------------------------------------#<table><tr><td><a><img></td><td>{QMENUS}</td><td><a><img></td></tr></table> ##-----[ AFTER, ADD ]------------------------------------------#<BEGIN> <table> <tr> <td> <span> This is our board test acount!<br> With this acount you can check our mods without registering.<br> Although you CANNOT post on the forums or edit your profile.</span></td> </tr> </table><END>##-----[ OPEN ]-----#templates/subSilver/admin/board_config_body.tpl ##-----[ FIND ]-----# <td><input> {L_YES} <input> {L_NO}</td> </tr> ##-----[ AFTER, ADD ]------------------------------------------# <tr> <td>{L_ALLOW_TEST_POST}</span></td> <td><input> {L_YES} <input> {L_NO}</td> </tr> ##-----[ OPEN ]-----#templates/subsilver/admin/user_edit_body.tpl ##-----[ FIND ]------------------------------------------# <input> <span>{L_NO}</span></td> </tr> ##-----[ AFTER, ADD ]------------------------------------------# <tr> <td><span>{L_TESTOR}</td> <td><input> <span>{L_YES}</span> <input> <span>{L_NO}</span> </td> </tr> ##-----[ SAVE/CLOSE ALL FILES ]------------------------------------------## EoM