Plugin Author
Miled
(@miled)
by default, once a user authenticate he will be automatically redirected to the page where he come from, but if for some reason WSL wasn’t able to identify the referer, then Redirect URL will be used instead.
a new option will be added soon to force redirection to Redirect URL regardless.
I would like to be able to redirect to a particular anchor ID on the page, so the user doesn’t have to scroll down to the end of the post and also perrhaps past the previous comments. I tried appending the anchor tag to the “redirect_to” value , so that instead of value='” + current_url + “‘, it becomes value='” + current_url + “#comments” + “‘, but that didn’t seem to work. I made this change to lines 45, 56, and 60 where that original value was. Is there an easier way to achieve this, and actually works?
wp-content\plugins\wordpress-social-login\assets\js\script.js
Plugin Author
Miled
(@miled)
is better to use wsl hooks.
function wsl_redirect_to( $redirect_to ) {
return 'http://example.com/#comments';
}
add_filter( 'wsl_hook_process_login_alter_redirect_to', 'wsl_redirect_to', 10, 1 );
where is the file I put that into?
I guess I am not sure what to do to implement wsl hooks as you indicated above
Plugin Author
Miled
(@miled)
sorry, I do know HOW to insert code…just wanted to know WHERE (what file)…
so you are saying this goes into functions.php
The remaining question is that in your example , “http://example.com/#comments” seems to be missing the variables for the existing post URL that is to be appended with #comments
also, shouldn’t the URL be a relative rather than absolute URL?
Plugin Author
Miled
(@miled)
your theme functions.php file will do
alternatively, you can create this file: wp-content/plugins/wp-social-login-custom.php, and wsl will load it automatically.
alternatively, you can create a plugin and put your hooks there
alternatively, hire someone if this sound too complicated.
edit: $redirect_to will tell you where the user come from. in your case you may append “#comments” to that variable like this
function wsl_redirect_to( $redirect_to ) {
return $redirect_to . '#comments';
}
add_filter( 'wsl_hook_process_login_alter_redirect_to', 'wsl_redirect_to', 10, 1 );
awesome, Miled. Thanks. That should get me through it (and it did…just tried it). Thank you very much. This is a great plugin. Just what I needed.