Добавяне на Потребители от Админ Панела
С този мод ще можете да добавяте потребители от админ панела на форума.

За въпроси тази тема




Източник: http://www.phpbbhacks.com/
Мода: http://www.phpbbhacks.com/download/1851
Няма файлове за качване а само за промяна
Ето какво представлява мода:
http://i.data.bg/07/12/31/733891_orig.jpg
http://i.data.bg/07/12/31/733893_orig.jpg
Тестван е и работи

#-----[ Отворете ]------------------------------------------------
#
admin/admin_users.php

#
#-----[ Намерете ]------------------------------------------------
#
define('IN_PHPBB', 1);

#
#-----[ След това добавете ]------------------------------------------
#

// Start add - Admin add user MOD
// define a "dummy user", the profile settings of this user, will be used as default settings for new users
define('DEFAULT_USER_ID', 2);
define('DEFAULT_PASSWD', '123456');
// End add - Admin add user MOD

#
#-----[ Намерете ]------------------------------------------------
#
//
// Begin program

#
#-----[ Преди това добавете ]-----------------------------------------
#

// Start add - Admin add user MOD
$new_user = (isset($HTTP_POST_VARS['new_user'])) ? (($HTTP_POST_VARS['new_user']==TRUE) ? TRUE : 0 ) : 0 ;
if ($new_user)
{
//see if user already exist
if (get_userdata($HTTP_POST_VARS['username']))
{
message_die(GENERAL_MESSAGE, $lang['Username_taken'] );
}
//see if default user exist
if ( !($default_user = get_userdata(DEFAULT_USER_ID) ) )
{
message_die(CRITICAL_MESSAGE, 'The DEFAULT_USER_ID are not set correctly, please correct this in admin/admin_users.php');
}
if ($mode == 'save' && isset( $HTTP_POST_VARS['submit'] ) )
{
//we need to create the user
$sql = "SELECT MAX(user_id) AS total
FROM " . USERS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
}
$user_id = $row['total'] + 1;
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_active)
VALUES ($user_id, 'new_user', " . time() . ",'0')";
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
VALUES ('', 'Personal User', 1, 0)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
}
$group_id = $db->sql_nextid();
//go get the usergroups, the default user are member of
$sql = "SELECT g.group_id
FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE NOT g.group_single_user AND ug.group_id=g.group_id AND ug.user_id='".DEFAULT_USER_ID."'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain default user group information', '', __LINE__, __FILE__, $sql);
}
while ($group_data = $db->sql_fetchrow($result))
{
//user join default groups
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES (".$group_data['group_id'].", $user_id, '0')";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error insert default groupst', '', __LINE__, __FILE__, $sql);
}
}

$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
VALUES ($user_id, $group_id, 0)";
if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
}
$HTTP_POST_VARS[POST_USERS_URL] = $user_id;
} else
{
//make script use default user as a starting point
$HTTP_POST_VARS[POST_USERS_URL] = DEFAULT_USER_ID;
}
}
// End add - Admin add user MOD

#
#-----[ Намерете ]------------------------------------------------
#
if ( (
{
$user_id = intval($HTTP_POST_VARS['id']);

#
#-----[ В реда намерете ]------------------------------------------------
#
$user_id = intval($HTTP_POST_VARS['id']);

#
#-----[ В реда заместете с ]----------------------------------------
#

// Start replacement - Admin add user MOD
$user_id = ($new_user) ? $user_id : intval($HTTP_POST_VARS['id']);
// End replacement - Admin add user MOD

#
#-----[Намерете ]------------------------------------------------
#
if( $HTTP_POST_VARS['deleteuser'] )

#
#-----[ В реда намерете ]----------------------------------------
#
)

#
#-----[ В реда преди това добавете ]---------------------------------
#
&& $new_user==0

#
#-----[ Намерете ]------------------------------------------------
#
if ($signature != '')

#
#-----[ Преди това добавете ]-----------------------------------------
#

// Start add - Admin add user MOD
else if ($new_user)
{
//no password given for this new user, create default password
$password = md5(DEFAULT_PASSWD);
$passwd_sql = "user_password = '$password', ";
//send out email notification goes here
}
// End add - Admin add user MOD

#
#-----[ Намерете ]------------------------------------------------
#
//
// Now parse and display it as a template

#
#-----[ Преди това Добавете ]-----------------------------------------
#

// Start add - Admin add user MOD
if ($new_user)
{
$this_userdata['username'] = $HTTP_POST_VARS['username'];
$this_userdata['user_email'] = '';
$this_userdata['user_passwd_change'] = 0;
} else
{
$template->assign_block_vars('switch_show_delete', array());
}
// End add - Admin add user MOD

#
#-----[ Намерете ]------------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="id"

#
#-----[ Преди това добавете ]-----------------------------------------
#

// Start add - Admin add user MOD
$s_hidden_fields .= '<input type="hidden" name="new_user" value="'.$new_user.'" />';
// End add - Admin add user MOD

#
#-----[ Намерете ]------------------------------------------------
#
$lang['User_admin_explain'],

#
#-----[ В реда намерете ]----------------------------------------
#
$lang['User_admin_explain'],

#
#-----[ В реда заместете с ]--------------------------------
#
($new_user) ? sprintf( $lang['Create_user_explain'],'<a href="'.append_sid('/profile.'.$phpEx.'?mode=viewprofile&'.POST_USERS_URL.'='.$default_user['user_id']).'">'.$default_user['username'].'</a>', DEFAULT_PASSWD ) : $lang['User_admin_explain'],

#
#-----[Намерете ]------------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="id"

#
#-----[Преди това добавете ]-----------------------------------------
#

// Start add - Admin add user MOD
$s_hidden_fields .= '<input type="hidden" name="new_user" value="'.$new_user.'" />';
// End add - Admin add user MOD

#
#-----[ Намерете ]------------------------------------------------
#
'body' => 'admin/user_select_body.tpl')
);

#
#-----[ След това добавете ]------------------------------------------
#

// Start add - Admin add user MOD
$template->assign_block_vars('switch_add_user_on', array());
// End add - Admin add user MOD

#
#-----[ Намерете ]------------------------------------------------
#
'L_FIND_USERNAME' => $lang['Find_username'],

#
#-----[ След това добавете ]------------------------------------------
#

// Start add - Admin add user MOD
'L_CREATE_USER' => $lang['Create_user'],
// End add - Admin add user MOD

#
#-----[Отворете ]------------------------------------------------
#
language/lang_english/lang_admin.php

#
#-----[Намерете ]------------------------------------------------
#
?>

#
#-----[ Преди това добавете ]-----------------------------------------
#

// Start add - Admin add user MOD
$lang['Create_user'] = 'Направи нов потребител';
$lang['Create_user_explain'] = 'You are about to create a new user, when creating a new user, the script will look up the data from this user %s, the user ID of this user is hard coded into the file admin_users.php, you may change this setting in the top of this file if another user ID should be used.<br />There is 2 exeptions from this: <br />1. users Password will default to "%s" if you do not specify differently into the admin add user page<br />2. users email must be filled into the admin add user page';
// End add - Admin add user MOD

#
#-----[ Отворете ]------------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl

#
#-----[ Намерете ]------------------------------------------------
#
<tr>
{L_DELETE_USER}

#
#-----[ Преди това добавете ]-----------------------------------------
#

<!-- Start add - Admin add user MOD -->
<!-- BEGIN switch_show_delete -->
<!-- End add - Admin add user MOD -->

#
#-----[Намерете ]------------------------------------------------
#
{L_DELETE_USER_EXPLAIN}
</tr>

#
#-----[След това добавете ]------------------------------------------
#

<!-- Start add - Admin add user MOD -->
<!-- END switch_show_delete -->
<!-- End add - Admin add user MOD -->

#
#-----[ Отворете ]------------------------------------------------
#
templates/subSilver/admin/user_select_body.tpl

#
#-----[ Намерете ]------------------------------------------------
#
<input type="text" class="post" name="username"

#
#-----[ В реда намерете ]----------------------------------------
#
;return false;" />

#
#-----[ В реда след това добавете ]----------------------------------
#
<input type="checkbox" name="new_user">{L_CREATE_USER}

#
#-----[ Запишете/затворете всички файлове ]--------------------------------








/ Трябва да сте регистриран за да напишете коментар /