This topic has 10 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #148024
     Roader
    Participant

    Hi there!

    Im trying to protect wp-login and wp-admin using for example (in .htaccess):

    ErrorDocument 401 “Unauthorized Access”

    ErrorDocument 403 “Forbidden”

    <FilesMatch “wp-login.php”>

    AuthName “Authorized Only”

    AuthType Basic

    AuthUserFile /home/myuser/public_html/.mysecretpass

    require valid-user

    </FilesMatch>

    But, I have a problem. When you click on LOG OUT, the Confirmation Windows appears.

    I dont want that!

    I saw that  SweetDate Theme has wp-login protected ===>

    WPDOCTOR Test Link For SweetDate

    So, what do you do for protect correctly… without problem for User’s  LOGOUT ??

     

     

    Attachments:
    You must be logged in to view attached files.
    #148027
     Roader
    Participant

    Other think:

    How can I to restringe the access to dashboard? For example, if a suscriptor write:

    mysite.com/wp-admin He or She can in to WP DashBoard. I dont want that.

    I did try with:

    COPY CODE
    //Acceso prohibido a Dashboard de suscriptores
    function restrict_access_admin_panel(){
                    global $current_user;
                    get_currentuserinfo();
                    if ($current_user->user_level <  4) {
                            wp_redirect( get_bloginfo('url') );
                            exit;
                    }
            }
            add_action('admin_init', 'restrict_access_admin_panel', 1);
    

    But, with this code an error:

    When a User fails with the LogIn, he is redirect to: wp-login.php

    I dont want that.

    Attachments:
    You must be logged in to view attached files.
    #148030
     Roader
    Participant
    COPY CODE
    // Limit WP Dashboard Access
    add_action( 'init', 'blockusers_init' );
    function blockusers_init() {
     if ( is_admin() && !current_user_can( 'administrator' ) && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
     wp_redirect( home_url() );exit;
     }
    }

    Okey, this code works, but, I need to add access for Shop manager, but, I dont know how

    #148139
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #148143
     Roader
    Participant

    Gracias Laura.

    Pues sí, yo veo que el Demo tiene protegido el wp-login, y no hay problema cuando le das a LogOut, sin embargo a mí me pasa que me pide ingresar nombre y clave para Salir.
    Por tanto, me gustaría ver de qué manera uds protegieron el wp-login de manera funcional.

    #148205
     Radu
    Moderator

    Hi,

    Those things aren’t related to the sweetdate theme. My opinion it’s to redirect somewhere else on log out http://stackoverflow.com/a/26870337

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #148240
     Roader
    Participant

    My friend Radu. I can see that the Theme SweetDate has the Wp-Login Protected.

    How do you that?

    #148249
     Roader
    Participant

    And Radu. I saw the link, but, I dont understand what I can do with:

    ” title=”Logout”>Logout

    I saw header.php, but, this file has an especific code… So, please, Help me!

    I need to protect Wp-admin and Wp-login (without plugin)… But, the problem is when a User click on LogOut…

    #148593
     Radu
    Moderator

    Hi,

    I don’t have a plug and play solution for this and I recommend you to use a plugin that does this already.

    And I’ve told you can use the function and action from this link : http://stackoverflow.com/questions/26870082/log-out-wordpress-and-redirect-to-different-url/26870337#26870337

    note: I haven’t tested the code!

    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #148630
     Roader
    Participant

    Hi Radu. Please, Test it and tell me!

    And please. NOT MORE PLUGINS! Right Now I have a big problem with a Plugin.

    Do you know the bug Full Path Disclosure?? Hehhe a Big problem. For me and you!

    Check your plugins! For example. WP Super Cache!

    With more supplements, the more insecure is WP! But, you know that! 🙂

    For this reason, I PREFER SECURE AND STANDARD PHP CODE!

    #148738
     Radu
    Moderator

    Hi,

    We don’t have a plug and ply code for that, please understand, you can use this plugin: https://wordpress.org/plugins/remove-dashboard-access-for-non-admins/

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?