Hello, i’m using your plugin (which i awesome),
i have a compatibility problem with the Snax plugin in Bimber theme.
The redirections i have setup in Member Types do not work when using
the login popup from Snax.
I have contacted them but they replied me this:“In our plugin we have this line of code:
$redirect_url = apply_filters( ‘snax_login_redirect_url’, $redirect_url, $user );
so the fix should be to be easy, apply the Buddypress Member Types “login_redirect” filter on our “snax_login_redirect” filter but it’s not. Your plugin has no public API and I can’t access its function that way. Please get back to the plugin author and ask him how to apply their redirect call on our filter. He should be able to help with this.”Can you help me? thanks in advance
SigfridoHi Sigfrido,
Thank you for using our member types pro.It seems they created an unnecessary filter instead of using the standard ‘login_redirect’.
I still appreciate them sharing the code snippet for their filter.
Please allow me to add compatibility and provide an update in 1-2 hours.
Thank you
BrajeshHi Sigfrido,
I had a look and need some clarification1. Please ask the Bimber support about this. In the code below.
$redirect_url = apply_filters( 'snax_login_redirect_url', $redirect_url, $user )
is $user Object or numeric id?
2. To answer their question about public API:- We did not consider people of even name a basic filter like login_redirect to their own preferences. It is plainly incorrect semantics on their part.
There is no harm in offering a public API in future for the same.
Regards
BrajeshThanks Brajesh, i’ll ask them and let you know asap π
Hi Brajesh
hereβ the reply from the people at Bimber:Hi,
The $user is a WP_User object returned, on success, from wp_signon() function.
Below the full code of that function:
function snax_ajax_login() {
$credentials = array();
$credentials[‘user_login’] = filter_input( INPUT_POST, ‘log’, FILTER_SANITIZE_STRING );
$credentials[‘user_password’] = filter_input( INPUT_POST, ‘pwd’, FILTER_SANITIZE_STRING );
$credentials[‘remember’] = filter_input( INPUT_POST, ‘rememberme’, FILTER_SANITIZE_STRING );
// Verify reCaptcha.
$use_recaptcha = snax_is_recatpcha_enabled_for_login_form();
if ( $use_recaptcha ) {
$recaptcha_token = filter_input( INPUT_POST, ‘g-recaptcha-response’, FILTER_SANITIZE_STRING );
$recaptcha_valid = snax_verify_recaptcha( $recaptcha_token );
if ( ! $recaptcha_valid ) {
snax_ajax_response_error( snax_get_recaptcha_invalid_message() );
exit;
}
}
$secure_cookie = is_ssl();
$user = wp_signon( $credentials, $secure_cookie );
if ( is_wp_error( $user ) ) {
$message = $user->get_error_message();
snax_ajax_response_error( $message );
exit;
}
$redirect_url = filter_input( INPUT_POST, ‘redirect_to’, FILTER_SANITIZE_STRING );
$redirect_url = apply_filters( ‘snax_login_redirect_url’, $redirect_url, $user );
// Strip snax vars.
$redirect_url = preg_replace( ‘/?’ . snax_get_login_popup_url_variable() . ‘.*/’, ”, $redirect_url );
$redirect_url = preg_replace( ‘/’ . snax_get_login_popup_url_variable() . ‘.*/’, ”, $redirect_url );
$response_args = array(
‘redirect_url’ => $redirect_url,
);
snax_ajax_response_success( ‘Log in successfull’, $response_args );
exit;
}Thank you.
I appreciate their feedback.I will post an update within couple of hours.
Regards
BrajeshHi Sigfrido,
Thank you for the patience.Please upgrade to 1.4.0 and let me know if it works or not?
Regards
BrajeshHi Brajesh,
It works like a charm, brilliant!
Thank you very much πRegards
SigfridoHi Sigfrido,
Thank you for confirming. I am glad it works now πRegards
Brajesh
The topic ‘ [Resolved] POssible conflict with Snax/Bimber’ is closed to new replies.