Advertisement
phpface

Untitled

Nov 30th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. if( ! function_exists( 'videotube_vt_logged_redirect_to' ) ){
  2.     /**
  3.      * Redirect the user to their channel page on theme forms.
  4.      * @param unknown_type $redirect_to
  5.      * @param unknown_type $user_id
  6.      * @return Ambigous <string, mixed>
  7.      */
  8.     function videotube_vt_logged_redirect_to( $redirect_to, $user_id ) {
  9.         return get_author_posts_url( $user_id );
  10.     }
  11.  
  12.     add_filter('vt_logged_redirect_to', 'videotube_vt_logged_redirect_to' , 100 , 2 );
  13. }
  14.  
  15. if( ! function_exists( 'videotube_default_login_redirect' ) ){
  16.     /**
  17.      * Redirect the user to their channel page on WP default login form.
  18.      * @param unknown_type $redirect_to
  19.      * @param unknown_type $request
  20.      * @param unknown_type $user
  21.      * @return Ambigous <string, mixed>
  22.      */
  23.     function videotube_default_login_redirect( $redirect_to, $request, $user ) {
  24.         if( isset( $user->ID ) ){
  25.             $redirect_to    =   get_author_posts_url( $user->ID );
  26.         }
  27.         return $redirect_to;
  28.     }
  29.     add_filter( 'login_redirect', 'videotube_default_login_redirect', 10, 3 );
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement