Advertisement
Guest User

Untitled

a guest
Sep 28th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2. /**
  3. * @author: michael schmitt
  4. * @desc: copy file to the / of a wordpress instance
  5. * execute on commandline: php user.php username + password
  6. */
  7. if($argc < 3) {
  8. die("usage php user.php username password" .PHP_EOL);
  9. }
  10. $userName= $argv[1];
  11. $password=$argv[2];
  12. echo $userName;
  13.  
  14.  
  15.  
  16.  
  17.  
  18. require( dirname( __FILE__ ) . '/wp-blog-header.php' );
  19.  
  20. $user_id = get_user_by('name', $userName);
  21. if(null !== $user_id) {
  22. $user_id = wp_create_user($userName, $password);
  23. $user = new WP_User( $user_id );
  24. $user->set_role( 'administrator' );
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement