Prechádzať zdrojové kódy

Register Module Changes - Removed Password - Added Preference for User Receiving Emails - Mainly Applies to Admins

own3mall 7 rokov pred
rodič
commit
6740a8ff66

+ 2 - 2
includes/form_table_class.php

@@ -98,13 +98,13 @@ class FormTable {
 			if ( @$value == 0 )
 				echo "selected='selected'";
 
-			echo ">".'off'."</option>";
+			echo ">". get_lang("off") ."</option>";
 			echo "<option value='1' ";
 
 			if ( @$value == 1 )
 				echo "selected='selected'";
 
-			echo ">".'on'."</option></select>";
+			echo ">". get_lang("on") ."</option></select>";
 		}
 		else if ($type === "text")
 		{

+ 2 - 2
lang/English/modules/register.php

@@ -40,7 +40,7 @@ define('OGP_LANG_successfull', "Successful");
 define('OGP_LANG_click_here', "Click here");
 define('OGP_LANG_to_login', "to login.");
 define('OGP_LANG_registered_on', "Registered on: %s.");
-define('OGP_LANG_register_message', "Hello,<br><br>Your Open Game Panel account has been created and you may now login using the following account information:<br><br>Username: %s<br>Password: %s<br><br>Remember to change your password often and the first time you login.<br><br>Please do not reply to this email!<br><br>______________________________<br>OGP Mailer");
+define('OGP_LANG_register_message', "Hello,<br><br>Your Open Game Panel account has been created and you may <a href='%s' target='_blank'>login now</a>.<br><br>Username: %s<br><br>Remember to change your password often and the first time you login.<br><br>Please do not reply to this email!<br><br>______________________________<br>OGP Mailer");
 define('OGP_LANG_err_captcha', "Captcha does not match.");
 define('OGP_LANG_err_login_name', "User name is empty or in use.");
 define('OGP_LANG_err_first_name', "Enter your name.");
@@ -52,4 +52,4 @@ define('OGP_LANG_user_registration', "User Registration");
 define('OGP_LANG_your_account_details_has_been_sent_by_email_to', "Your account details has been sent by email to <b>%s</b>.");
 define('OGP_LANG_account_created', "Your account has been created.");
 define('OGP_LANG_subject', "%s :: Account Information");
-?>
+?>

+ 1 - 0
lang/English/modules/user_admin.php

@@ -109,4 +109,5 @@ define('OGP_LANG_enter_valid_username', "Please enter a valid username.");
 define('OGP_LANG_unexpected_role', "Unexpected user role received.");
 define('OGP_LANG_search', "Search");
 define('OGP_LANG_api_token', "API token");
+define('OGP_LANG_user_receives_emails', "Receive Emails");
 ?>

+ 5 - 3
modules/register/register-exec.php

@@ -43,8 +43,10 @@ function exec_ogp_module()
 	$admins = $db->getAdmins();
 	if(is_array($admins) && count($admins) > 0){
 		foreach($admins as $admin){
-			$adminEmail = $admin['users_email'];
-			$adminEmailList .= $adminEmail . ',';
+			if($admin['user_receives_emails']){
+				$adminEmail = $admin['users_email'];
+				$adminEmailList .= $adminEmail . ',';
+			}
 		}
 	}
 	
@@ -187,7 +189,7 @@ function exec_ogp_module()
 				else
 					$subject = get_lang_f('subject',$settings['panel_name']);
 				
-				$message = get_lang_f('register_message',$users_login,$_POST['users_passwd']);
+				$message = get_lang_f('register_message', getOGPSiteURL(), $users_login);
 				
 				$mail = mymail($to, $subject, $message, $settings);
 				

+ 11 - 0
modules/user_admin/edit_user.php

@@ -143,6 +143,11 @@ function exec_ogp_module() {
 			$fields['users_comment'] = sanitizeInputStr($_POST['comment']);
 			$fields['user_expires'] = $expire_timestamp;
 			$fields['users_login'] = $login;
+			
+			// Handle email preference
+			if(isset($_POST['user_receives_emails']) && is_numeric($_POST['user_receives_emails'])){
+				$fields['user_receives_emails'] = sanitizeInputStr($_POST['user_receives_emails']);
+			}
 		}
 
 		if ( empty($theme) )
@@ -230,6 +235,12 @@ function exec_ogp_module() {
 	$ft->add_field('string','province',$userInfo['users_province'], 64);
 	$ft->add_field('string','country',$userInfo['users_country'], 64);
 	$ft->add_field('string','api_token',$db->getApiToken($userInfo['user_id']), 64, "readonly");
+	
+	// Receives email notifications (for admins only --- really)
+	if ( $isAdmin ) {
+		$ft->add_field('on_off','user_receives_emails',$userInfo['user_receives_emails']);
+	}
+	
 	if ( $isAdmin && $userInfo['users_role'] != "subuser" ) {
 		$ft->add_custom_field('user_role',
 			create_drop_box_from_array(array('user', 'admin'),"newrole", $userInfo['users_role']));

+ 2 - 1
modules/user_admin/module.php

@@ -25,7 +25,7 @@
 // Module general information
 $module_title = "User admin";
 $module_version = "1.1";
-$db_version = 6;
+$db_version = 7;
 $module_required = TRUE;
 $module_menus = array(
     array( 'subpage' => '', 'name'=>'User Admin', 'group'=>'admin' ),
@@ -91,4 +91,5 @@ $install_queries[3] = array(
 $install_queries[4] = array("UPDATE ".OGP_DB_PREFIX."users SET users_email = DEFAULT WHERE users_email = '';");
 $install_queries[5] = array("ALTER TABLE `".OGP_DB_PREFIX."user_groups` MODIFY group_id int(11) NOT NULL;");
 $install_queries[6] = array("ALTER TABLE `".OGP_DB_PREFIX."users` ADD `users_page_limit` int(11) NULL DEFAULT 25;");
+$install_queries[7] = array("ALTER TABLE `".OGP_DB_PREFIX."users` ADD `user_receives_emails` tinyint(1) NOT NULL DEFAULT 1;");
 ?>