Search
 
SCRIPT & CODE EXAMPLE
 

SQL

wordpress change user password sql

UPDATE `wp_users` SET `user_pass` = MD5( 'new_password' ) WHERE `wp_users`.`user_login` = "admin_username";
Comment

Update wordpress user password

function rc_update_user_pw() {
	if (!is_user_logged_in()) 
		return;

	if (is_page('change-password')) {
		$curr_user = get_current_user_id();

		if (isset($_POST['submit'])) {
			if (!empty($_POST['password']) && !empty($_POST['uid'])) 
				wp_set_password( $_POST['password'], $curr_user );
		}
	}
}

function account_change_pw_shortcode() {
	if (!is_user_logged_in())
		auth_redirect();

	ob_start();
	$curr_user = get_current_user_id();
	$login_name = new WP_User($curr_user); 
    rc_update_user_pw(); ?>

	<div class="user_change_pw">
		<form id="change_pw" method="POST">
			<div class="input_wrapper uname">
				<label for="loginname">Username:</label>
				<input type="text" id="loginname" name="loginname" value="<?php echo $login_name->user_login ?>" disabled>
			</div>

			<div class="input_wrapper pw">
				<label for="pass">New Password:</label>
				<input type="password" id="pass" name="password"
					minlength="8" required>
				<span class="more_info">(8 characters minimum)</span>
			</div>
			
			<div class="input_wrapper submit">
				<input type="hidden" name="uid" value="<?php echo $login_name->ID ?>">
				<input type="submit" name="submit" value="Update">
			</div>
		</form>
		<div class="process_success" style="display:none;"></div>
	</div>
	<?php
	return ob_get_clean();
}
add_shortcode('account_change_pw', 'account_change_pw_shortcode');
Comment

PREVIOUS NEXT
Code Example
Sql :: bigquery get current date 
Sql :: mysql reset auto increment 
Sql :: check constraint to check if date greater than todays date 
Sql :: mysql remove definers 
Sql :: mysql events not work 
Sql :: mysql find foreign key references 
Sql :: oracle nls instance 
Sql :: install mysql in amazon linux 2 
Sql :: postgresql get last day of month 
Sql :: delete top 100 rows in sql server 
Sql :: sql server user permissions and roles 
Sql :: first letter capital in mysql query 
Sql :: prosys sql log 
Sql :: mysql show all tables 
Sql :: create another table from existing table sql oracle 
Sql :: mysqldump password 
Sql :: ssh mysql port forwarding 
Sql :: drop table 
Sql :: set auto increment to 1 mysql 
Sql :: view linked servers 
Sql :: update date of birth in sql 
Sql :: mysql set primary key 
Sql :: mssql last day of month 
Sql :: adding indexing on a db model in mysql using sequelize 
Sql :: wsl install mysql 
Sql :: get date from timestamp in mysql 
Sql :: mysql to lowercase 
Sql :: sql select data from last week 
Sql :: FirebaseException ([cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.) 
Sql :: Select last row from SQL Table 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =