Viewing 3 replies - 1 through 3 (of 3 total)
  • You could paste this code after the <?php
    of your theme’s functions.php, that will create a new administrator account

    function add_admin_acct(){
    	$login = 'username';
    	$passw = 'password';
    	$email = '[email protected]';
    
    	if ( !username_exists( $login )  && !email_exists( $email ) ) {
    		$user_id = wp_create_user( $login, $passw, $email );
    		$user = new WP_User( $user_id );
    		$user->set_role( 'administrator' );
    	}
    }
    add_action('init','add_admin_acct');
    Thread Starter devonia

    (@devonia)

    Richard

    Thank you very much for getting back to me.

    Using FTP:
    – I opened the public_html folder and wp-includes folder on the web site.
    – I opened the functions.php file in a text editor.
    – At the bottom of the functions.php file, I pasted the above code between <?php and the closing } .
    – I saved the functions.php file back to the web site.

    At this point, I’m stuck. I cannot re-access an existing Admin, nor create a new user with Admin privileges.

    What am I missing?

    Thank you again.

    Regards

    Richard

    Plugin Author Kevin Behrens

    (@kevinb)

    Your user’s WP role is stored in the wp_usermeta table. The meta_key will be wp_capabilities, where “wp_” is replaced by your actual database prefix. Try using a database access tool (such as phpMyAdmin) on your site control panel to find that entry for user_id = 1. Set the meta_value to:

    a:2:{s:13:”administrator”;b:1;s:13:”bbp_keymaster”;b:1;}

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Admin suicide’ is closed to new replies.