Advertisement
johnrom

Removing Theme My Login's Theming of Logins

Feb 16th, 2014
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. /**
  2.      * We are ironically undoing theme my login's theming of the login
  3.      * (and keeping registration approvals)
  4.      * (and keeping themed profiles)
  5.      * @param  string $link   what tml wants
  6.      * @param  string $action what the user wants to do
  7.      * @param  array  $query  where the user is going
  8.      * @return string $link   what the client wants
  9.      */
  10.     function remove_tml_login_pages( $link, $action, $query ) {
  11.  
  12.         if ( $action !== 'logout' && class_exists( 'Theme_My_Login') ) {
  13.             // remove redundancy on admin_url
  14.             remove_filter('tml_page_link', array( $this, 'remove_tml_login_pages'), 10, 3 );
  15.  
  16.             if ( ! isset( $query['redirect_to'] ) )
  17.                 $query['redirect_to'] = urlencode( admin_url('profile.php') );
  18.  
  19.             if ( ! isset( $query['action'] ) )
  20.                 $query['action'] = $action;
  21.  
  22.             $theme_my_login = Theme_My_Login::get_object();
  23.  
  24.             // remove redundancies
  25.             remove_filter('site_url', array( $theme_my_login, 'site_url' ), 10, 3 );
  26.  
  27.             $link = add_query_arg( $query, site_url('wp-login.php') );
  28.  
  29.             // put 'em back
  30.             add_filter('site_url', array( $theme_my_login, 'site_url'), 10, 3 );
  31.             add_filter('tml_page_link', array( $this, 'remove_tml_login_pages'), 10, 3 );
  32.         }
  33.  
  34.         return $link;
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement