How to remove login popup and redirect user on User Pro login page?

6.85K viewsGeneral
0

I have used User Pro plugin to maintain user login and registration. So i want to integrate AnsPress with User Pro. And i want to redirect user on User Pro login/registration page when user click login/signup from ask question or write answer page  if he is not logged in.

Thank You!

0

this worked for me
function ap_page_template_redirect()
{
if( is_ask() && ! is_user_logged_in() )
{
auth_redirect();
exit();
}
}

0

Add this to your theme functions.php

function ap_page_template_redirect()
{
    if( ap_get_ask_page_slug() == ap_current_page() && ! is_user_logged_in() )
    {
        auth_redirect();
        exit();
    }
}
add_action( 'template_redirect', 'ap_page_template_redirect' );

Thank You sir for the response. But its not working.
i have added that code at the end of this file /wp-content/plugins/anspress-question-answer/theme/default/functions.php.
It gives error as below.
Call to undefined function ap_get_ask_page_slug() in /wp-content/plugins/anspress-question-answer/theme/default/functions.php on line 244