• Resolved Stefan

    (@webcam)


    Hey,

    thank you for the plugin!

    Is it possible to setup this nice plugin in to a oop version. it would be much more safer and it will come with an professional look. ??

    second: there is a is_admin() behavior: if i will access (not logged in) to /wp-admin/ your plugin creates an 404(). but we are in a is_admin() situation, so some of my scripts which i only will load in the frontend, wont show up and generates some ugly errors.

    for example: if you load in your functions.php like that:

    if( !is_admin() ) {?load_some_css() }

    in your 404, those css files wont ever load, because technically, your in admin mode. ?? is it possible, to redirect permanent to a another link, so we run out of the admins area?

    https://www.ads-software.com/plugins/rename-wp-login/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ella

    (@ellatrix)

    Thank you!

    Yes, I’ll do that at some point.

    Could you explain your second situation with more detail? Can you give a specific example?

    Thread Starter Stefan

    (@webcam)

    ok.

    create a php file “class.php”, insert something like ( class fun {} )

    in your functions.php, add:

    if( !is_admin() ) { include('class.php'); }

    open your 404.php, add:

    $fun = new fun();

    now, try your 404 while type https://www.example.com/xxxx (not existing page), into your browser: your 404 will show up correctly.

    now log off and type https://www.example.com/wp-admin/ into your browser:

    404 shows up, but with an error like “cannot find class “fun”. because /wp-admin actually is “is_admin();

    its a stupid example, but i hope u’ll see what i mean. ??

    ———-

    second thought on the 404 problem. If you have a multisite installed, user can be added via the backend in several ways. they will retrieve some confirmation mails – with the wrong url in it (/wp-admin).

    because we can’t change the admin_url, i’ve added into your rwl_404() function:

    if (
        isset( $_SERVER['HTTP_REFERER'] ) &&
       (     strpos( $_SERVER['HTTP_REFERER'], 'newbloguser' ) !== FALSE
         || strpos( $_SERVER['HTTP_REFERER'], 'wp-activate.php' ) !== FALSE )
      ) {
    
         wp_redirect( rwl_login_url() );
         exit;
    
    }

    i know, this is not save, but at the moment, the best solution. so user wont land on a 404 page, if they click the login link.

    Plugin Author Ella

    (@ellatrix)

    Thanks for pointing this out. You could use ! is_admin() || is_404() and it should work. There’s just no way to filter is_admin()… I’ll think about it, but I don’t think it can be fixed.

    I know about those multisite problems, I’ll try to address them by the next release!

    Thanks!

    Plugin Author Ella

    (@ellatrix)

    wp-admin now just shows you a wp_die message if you’re not logged in. That should solve these issues. In the next version I’ll introduce some filters to redirect to a custom url.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘is_admin() and OOP’ is closed to new replies.