Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. function getUserIDandPush($ul){
  2. global $table_prefix; // Prefix for Database table
  3. global $user_login;
  4. global $wpdb; // Wordpress WPDB database method
  5. $dt = $table_prefix; //Tables Prefix
  6. $as = $wpdb->get_results('SELECT * FROM '.$dt.'users WHERE user_login = "'.$ul.'" ');
  7. $usID = $as[0]->ID;
  8. wp_set_current_user($usID, $ul);
  9. wp_set_auth_cookie($usID);
  10. do_action('wp_login', $ul);
  11. }
  12.  
  13. function getUserIDandPush($ul){
  14. global $table_prefix; // Prefix for Database table
  15. global $user_login;
  16. global $wpdb; // Wordpress WPDB database method
  17. $dt = $table_prefix; //Tables Prefix
  18. if (!is_user_logged_in() && isset($_SERVER['LOGON_USER'])) {
  19. $as = $wpdb->get_results('SELECT * FROM '.$dt.'users WHERE user_login = "'.$ul.'" ');
  20. $usID = $as[0]->ID;
  21. wp_set_current_user($usID, $ul);
  22. wp_set_auth_cookie($usID);
  23. do_action('wp_login', $ul);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement