Answers for "How to create new wordpress user from php myadmin"

PHP
1

wordpress create user php

// ADD THIS TO YOUR FUNCTIONS.PHP FILE AND THEN RELOAD ANY PAGE
/////////////////////////////////////////////////////////////////

add_action( 'init', function () {				  
	// set username, password, and email address
  	$username = 'user';
	$password = 'password';
	$email_address = '[email protected]';

  	if ( ! username_exists( $username ) ) {
    	$user_id = wp_create_user( $username, $password, $email_address );
    	$user = new WP_User( $user_id );
    	// set the role (administrator, contributor, subscriber)
      	$user->set_role( 'administrator' );
  	}

} );
Posted by: Guest on October-17-2021
0

add user mysql wordpress

INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'demo', MD5('demo'), 'Your Name', '[email protected]', 'http://www.test.com/', '2011-06-07 00:00:00', '', '0', 'Your Name');
 
 
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
 
 
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10');
Posted by: Guest on September-16-2020
1

wordpress register user php

<php 
        // register
        
        $user = (isset($_POST['username']) ? $_POST['username'] : '');
        $pass = (isset($_POST['password']) ? $_POST['password'] : '');
        $email = (isset($_POST['email']) ? $_POST['email'] : '');

        if (!username_exists($user)  && !email_exists($email)) {
            $user_id = wp_create_user($user, $pass, $email);
            if (!is_wp_error($user_id)) {
                //user has been created
                $user = new WP_User($user_id);
                $user->set_role('do');
                //Redirect
                wp_redirect('URL_where_you_want_redirect');
                exit;
            } else {
                //$user_id is a WP_Error object. Manage the error
            }
        }else{
            // user exist
        }
?>
Posted by: Guest on September-11-2020

Code answers related to "How to create new wordpress user from php myadmin"

Browse Popular Code Answers by Language