Cole, I noticed that your plugin redirects to the same page unconditionally, instead of allowing the redirect to be changed. I suggest that you modify this block:
if ( ! is_user_logged_in() ) {
wp_localize_script( 'wpml-script', 'wpml_script', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'redirecturl' =>$_SERVER['REQUEST_URI',
'loadingmessage' => __( 'checking credentials...' ),
) );
}
to
if ( ! is_user_logged_in() ) {
wp_localize_script( 'wpml-script', 'wpml_script', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'redirecturl' => apply_filters('wpml_redirect_to',$_SERVER['REQUEST_URI']),
'loadingmessage' => __( 'checking credentials...' ),
) );
}
so that we can have control over what page WP Modal Login redirects to.
On the topic of s2Member, I do agree that the fault is s2Members. I have modified s2Member for now to filter the login_redirect instead of wp_redirect’ing on the wp_login hook, as I feel this is a more appropriate place to redirect. This, in combination with the filter I added to your plugin’s redirecturl, solved my problems for the time being.