Skip Navigation

[Resolved] Redirect user with [wpv-login]

This support ticket is created 2 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.38 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 2 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#2254981

Hello,

I would like to do the same kind of redirect but when logging in a user with [wpv-login]

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==3684){
        $choice = $_POST['wpcf-club'];
        if($choice == "1"){
                return '<em><u>hidden link</u></em>';
          }
        if($choice == "2"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "3"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "4"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "5"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "6"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "7"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "8"){
               return '#';
}
              if($choice == "9"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "10"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "11"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "12"){
               return '#';
}
              if($choice == "13"){
               return '#';
}
    }
    return $url;
}

Thank you

#2255223

Hello,

The filter hook "cred_success_redirect" works for Toolset post/user forms, I assume we are talking about shortcode [wpv-login-form]
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-login-form
If it is, you can use WordPress built-in filter hook "login_redirect", see WP document:
https://developer.wordpress.org/reference/hooks/login_redirect/

#2255607

Hello,

A code like this ?

add_filter( 'login_redirect', 'wpdocs_my_login_redirect', 10, 3 );
function wpdocs_my_login_redirect( $url, $request, $user)
{
    if ( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
        $choice = $_POST['wpcf-club'];
         if($choice == "1"){
                return '<em><u>hidden link</u></em>';
          }
        if($choice == "2"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "3"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "4"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "5"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "6"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "7"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "8"){
               return '#';
}
              if($choice == "9"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "10"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "11"){
               return '<em><u>hidden link</u></em>';
}
              if($choice == "12"){
               return '#';
}
              if($choice == "13"){
               return '#';
}
    }
    return $url;
}

Thank you

#2255737

According to our support policy, we don't provide such kind of custom codes support
https://toolset.com/toolset-support-policy/
You can also check it with our Toolset Contractors:
https://toolset.com/contractors/

And it seems you are gong to redirect user to other domain names, you need to add those domain names here:
Dashboard-> Toolset-> Settings-> Front-end Content, in section "Safe redirects"

More help:
https://developer.wordpress.org/reference/hooks/allowed_redirect_hosts/