Root Relative URLs and user emails
-
Quick fix to a problem I just ran into (maybe can be included in next version?)
Scenario: using Root Relative URLs plugin (or accomplishing the same thing via other means) results in user activation emails etc. not having valid links, for example
/login
instead ofhttps://foo.org/login.
For most emails this can be worked around via the plugin’s email functions. If you’ve activated Security and the account lockout feature, that email is not editable via the admin. Here is a quick fix:
/wp-content/plugins/theme-my-login/modules/security.php
, right at the end, around line 594, replace:$unlock_url = add_query_arg( array( 'action' => 'unlock', 'key' => self::get_user_unlock_key( $user->ID ), 'login' => rawurlencode( $user_login ) ), wp_login_url() );
with
// fix for root relative URLs $unlock_url = wp_login_url(); if ( strpos( $unlock_url, 'http' ) !== 0 ) { // root relative URL, add site url $unlock_url = site_url( $unlock_url ); } $unlock_url = add_query_arg( array( 'action' => 'unlock', 'key' => self::get_user_unlock_key( $user->ID ), 'login' => rawurlencode( $user_login ) ), $unlock_url );
Hope this helps someone.
- The topic ‘Root Relative URLs and user emails’ is closed to new replies.