Another one, when I try to goto /login (my defined url is NOT /login but another /something) :
Notice: Trying to get property of non-object in /…/wp-content/plugins/better-wp-security/inc/secure.php on line 791
Whereafter a message that headers were already send and a blank screen
THIS IS CAUSED because $post is NULL when not logged in, so you can not use it like $post->post_password.
if i do an echo of the $url above it I get:
http://mysite.com
/dashboard
/admin
/login
http://mysite.com/wp-login.php
and then the error follows, so it goes through some tries and somehow matches wp-login after “/login”
ADDENDUM
——–
If I remove php error checking /login redirects to /wp-login.php independently of what i set as alternate login page.
continued:
I’m using Nginx on a single site install and have not much other plugins installed.
I changed the Nginx ofcourse with the config on the dashboard, i looked through it and /login is nowhere to be found
Update , I think it is because of this part in “/wp-includes/canonical.php” :
function wp_redirect_admin_locations() {
global $wp_rewrite;
if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) )
return;
$admins = array(
home_url( 'wp-admin', 'relative' ),
home_url( 'dashboard', 'relative' ),
home_url( 'admin', 'relative' ),
site_url( 'dashboard', 'relative' ),
site_url( 'admin', 'relative' ),
);
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {
wp_redirect( admin_url() );
exit;
}
$logins = array(
home_url( 'wp-login.php', 'relative' ),
home_url( 'login', 'relative' ),
site_url( 'login', 'relative' ),
);
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) {
wp_redirect( site_url( 'wp-login.php', 'login' ) );
exit;
}
}
I think the following action: add_action( ‘template_redirect’, ‘wp_redirect_admin_locations’, 1000 );
Might be handy to remove IF a user chooses to set custom names for the login pages etc… otherwise that functionality is of no use.
I added
remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
right above it, which stops the canonical work, another place might be better (priorities must match)
Thanks for the updates. I will work these in to the next update. I’m starting to think I’ll need a second dev on this one to keep up so I am most grateful for the code.
I’ve taken a look at this and I’m admittedly a little confused about not finding login. Are you getting an error?
Hi Bit51,
Sorry might be confusing, there are 2 notices and 1 undesired behaviour, they are unrelated and seperated issues:
Notice 1 =
Notice: Undefined property: log_content_6_table::$hook in /wp-content/plugins/better-wp-security/inc/admin/tables.php on line 520
N/A
Notice 2 =
Trying to get property of non-object in /.../wp-content/plugins/better-wp-security/inc/secure.php on line 791
And 3rd the undesired behaviour is:
a) you set a custom login url e.g. “/whateverloginlanding”
b) you active it and add the stuff to nginx.conf / nginx stop / nginx start
c) you go to /login and it will display the login page, i believe this is because of the canonical implementation in WP.
Thanks for the clarification. I’ll take a look at getting it fixed.
I’ve committed a fix to the development version at http://downloads.wordpress.org/plugin/better-wp-security.zip however I haven’t been able to duplicate the login issue in any of the sites I have. Can you please test and let me know if that gets it?
sure, yes, however im quite busy now on a project so this will probably only be the end of august before i give the feedback.
i have put in my @todo list.