Return to Snippet

Revision: 49923
at August 2, 2011 09:43 by Celdatari


Initial Code
function upgrade_user($userID)
		{
			global $AI;

			require_once( ai_cascadepath('includes/plugins/user_management/includes/class.te_user_management.php') );
			$te_um = new C_te_user_management();
			$te_um->te_mode = 'update';
			foreach ( $te_um->writable_db_field as $n => $v )
			{
				$te_um->writable_db_field[$n] = false;
			}
			$te_um->writable_db_field['username'] = true;
			$te_um->writable_db_field['password'] = true;
			$te_um->writable_db_field['account_type'] = true;
			$te_um->db['username'] = $this->db['username'];
			$te_um->db['password'] = $this->db['password'];
			$_POST['retype_password'] = $this->db['password']; // won't pass validation w/o this
			//$te_um->db['account_type'] = 'Member'; // don't become Member yet, this function called only at step 1 of process
			//$te_um->db['account_type'] = 'Pre-Enrollee';
			$te_um->db['account_type'] = 'Member'; // one step: can do this now
			$te_um->admin_section_override = true;

			// SEND UPGRADE ALERT EMAIL
			$sponsor_userID = (int) db_lookup_value('genealogy', 'userID', $userID, 'sponsor_id');
			$sponsor_email = db_lookup_value('users', 'userID', $sponsor_userID, 'email');
			require_once( ai_cascadepath('includes/plugins/system_emails/class.system_emails.php') );
			$se = new C_system_emails(array());
			$se->util_translate_placeholders_userID = $sponsor_userID;
			$se->load('upgrade', 'event', 'Pre-Enrollee');
			$se->send_message($sponsor_email);

			return $te_um->update($userID);
		}

Initial URL

                                

Initial Description
Code is to upgrade a user in the user management table edit

Initial Title
Function: Update User

Initial Tags

                                

Initial Language
PHP