L
L
ligisayan2016-03-28 11:54:57
User identification
ligisayan, 2016-03-28 11:54:57

How to set up a redirect to your profile in Theme My Login plugin?

Greetings. There is a wordpress site on which the Theme My Login profile plugin is installed in which 2 pages are created:
1 - my account, where it is immediately transferred after user authorization and
2 - your profile
how to make it so that after authorization it transfers the user to your profile, and not my account?
I tried to play with links - so far I have not been able to come up with anything effective ..
here are the functions responsible for the
ajax.php redirect

public function tml_redirect_url( $url, $action ) {
    if ( Theme_My_Login::is_tml_page() && in_array( $action, self::default_actions() ) && isset( $_GET['ajax'] ) ) {
      switch ( $action ) {
        case 'lostpassword' :
        case 'retrievepassword' :
        case 'register' :
          $url = add_query_arg( 'ajax', 1, $url );
          break;
        case 'login' :
          $url = Theme_My_Login::get_page_link( 'login', 'ajax=1' );
          break;
      }
    }
    return $url;
  }

class-theme-my-login-template.php
public function the_redirect_url( $action = '' ) {
    echo esc_attr( $this->get_redirect_url( $action ) );
  }
  public function get_redirect_url( $action = '' ) {

    $theme_my_login = Theme_My_Login::get_object();

    if ( empty( $action ) )
      $action = $this->get_option( 'default_action' );

    $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';

    switch ( $action ) {
      case 'lostpassword' :
      case 'retrievepassword' :
        $url = apply_filters( 'lostpassword_redirect', ! empty( $redirect_to ) ? $redirect_to : Theme_My_Login::get_page_link( 'login', 'checkemail=confirm' ) );
        break;
      case 'register' :
        $url = apply_filters( 'registration_redirect', ! empty( $redirect_to ) ? $redirect_to : Theme_My_Login::get_page_link( 'login', 'checkemail=registered' ) );
        break;
      case 'login' :
      default :
        $url = apply_filters( 'login_redirect', ! empty( $redirect_to ) ? $redirect_to : admin_url(), $redirect_to, null );
    }
    return apply_filters( 'tml_redirect_url', $url, $action );
  }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
ligisayan, 2016-03-28
@ligisayan

Made it much easier - on the personal account page I placed the profile shortcode
[theme-my-login default_action=profile profile_template=tml-profile-form.php]

P
Pshkll, 2016-03-28
@Pshkll

function tml_redirect_url( $url, $action ) {
  if ( 'register' == $action )
    $url = 'АДРЕС';
  return $url;
}
add_filter( 'tml_redirect_url', 'tml_redirect_url', 10, 2 );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question