Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. function handle_register_user()
  2. {
  3. if (!isset($_POST['_mynonce']) || !wp_verify_nonce($_POST['_mynonce'], 'register-user')) {
  4. echo "error";
  5. die();
  6. }
  7.  
  8. $email = $_POST['email'];
  9. $password = $_POST['password'];
  10. $username = $_POST['username'];
  11.  
  12. $user_id = wp_create_user( $username, $password, $email );
  13. $url = plugin_dir_url( __FILE__ ) . 'template/user_dashboard.php';
  14.  
  15. if (!is_int($user_id)) {
  16. echo "error";
  17. return;
  18. }
  19. wp_redirect($url.'?id='.$user_id);
  20.  
  21. exit;
  22.  
  23. }
  24.  
  25. <?php
  26.  
  27. $id = $_GET['id'];
  28. global $wpdb;
  29. var_dump($wpdb);exit;//null
  30.  
  31. $query = "SELECT * FROM wp_users WHERE ID = $id";
  32.  
  33. $result = $wpdb->get_results($query);
  34. var_dump($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement