• Resolved andresmolina

    (@andresmolina)


    Hi,

    I was using a plugin that allows us to do the exact same thing you have on yours to hide the login page. But, we have the following code on our functions.php file, so it allows us to redirect to the login page based on the referrer (we need such fucnionality in order to operate with our external services), but it seems it does not work with your plugin, although it did on the previous plugin, would you help us out?:

    add_action( 'template_redirect', 'services_redirect');
    function services_redirect() {
    if (!is_user_logged_in() && strpos($_SERVER['HTTP_REFERER'], "services") !== false){
            wp_redirect( site_url('/customlogin/') ); 
            exit; 
        }   
    }

    Thanks
    Kind regards

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi,

    I don’t know why your function code is not working. However, the following plugin works well with ours. Some of our users have reported great results using both plugins and Rename Login Page feature is also active.

    https://www.ads-software.com/plugins/peters-login-redirect/

    Let me know if the above works for you.

    Thank you

    Thread Starter andresmolina

    (@andresmolina)

    Well, the idea is to not have to install another plugin.. if i had to do so, I would then install the old plugin we had, that worked just fine. Did you try our above code on one of your sites? Did it work? It definetely does not work on our side. I tried moving that piece of code to the top of our functions.php file with no luck. Any other suggestion?

    Thanks
    Kind regards

    Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi,

    Did you try our above code on one of your sites?

    Yes I have. However that function is customized for your site and will not work elsewhere.

    If you are going to use this feature “Rename Login Page” in our plugin and require extra functionality, then I recommend the above mentioned plugin.

    Kind regards

    Thread Starter andresmolina

    (@andresmolina)

    I know the function is customized, but the hooks used are universal, so im trying to understand what is it making this not to work..

    Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi,

    if i had to do so, I would then install the old plugin we had, that worked just fine

    Can you share the link to your old plugin? The function is probably hooking into your old plugin.

    Regards

    Thread Starter andresmolina

    (@andresmolina)

    Sure! with your permission, the other plugin is: WPS Hide Login

    https://es.www.ads-software.com/plugins/wps-hide-login/

    Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi, thank you for sharing the plugins URL.

    If you want to use your function “Designed to work with your other plugin” with our plugin you will need to make some changes. Below are a couple of samples hooks that might help you.

    Sample 1

    This hook added to your functions.php file, allows you to redirect to a 404 page error URL instead of a 403 WordPress error message.

    add_action( 'template_redirect', 'services_redirect');
    function services_redirect() {
    if (!is_user_logged_in() && strpos($_SERVER['HTTP_REFERER'], "services") !== false){
            wp_redirect( site_url('/customlogin/') ); 
            exit; 
        }   
    }

    Sample 2

    This hook added to your functions.php file, allows you to redirect to a page of your choice.

    add_action('aiowps_before_wp_die_renamed_login', 'redir_aiowps_before_die');
    function redir_aiowps_before_die(){
     wp_redirect('https://whatever-page-you-want.com');
     exit;
    }

    Kind regards

    Thread Starter andresmolina

    (@andresmolina)

    Hey! thanks a lot this one worked for me:

    add_action( 'aiowps_before_wp_die_renamed_login', 'services_redirect');
    function services_redirect() {
    if (!is_user_logged_in() && strpos($_SERVER['HTTP_REFERER'], "services") !== false){
            wp_redirect( site_url('/customlogin/') ); 
            exit; 
        }   
    }

    Really appreciate your help guys!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Login URL prevention rules’ is closed to new replies.