Facebook login redirection and another way to echo login/register button instead widget

Hi everyone!

Two questions, if anyone could help me.

1) Is there some way to redirect user after login via Facebook to the same page request?

2) Is there some function to echo the login/register button instead of using Facebook Connect widget?

Thanks for advance

  • aecnu
    • WP Unicorn

    Greetings bruno_brant,

    Thank you for these great questions and significant items to bring up.

    1) Is there some way to redirect user after login via Facebook to the same page request?

    Please clarify this question because I cannot figure out what you mean here by the same page request.

    2) Is there some function to echo the login/register button instead of using Facebook Connect widget?

    Are you referring to something like a short code? Logged into the site admin dashboard go to Facebook --> Short codes --> Connect shortcode

    Please advise.

    Cheers, Joe

  • Nauweb
    • WPMU DEV Initiate

    Hi Aecnu, thanks for fast repply.

    About first question, in Facebook settings --> Facebook Connect --> option Redirect on login there are two options and a field to provide URL for redirect (this field is empty).

    I would like when the user log in via facebook remains on the current page and not be redirected to site URL or admin page.

    About second question, thanks, I found, just in my face!

    Thanks a lot.

  • aecnu
    • WP Unicorn

    Greetings bruno_brant,

    Thank you for letting me know that one issue was resolved and the other issue is still awaiting a qualified answer as to the redirect or more accurately in this case to not be redirected.

    Since I do not know that answer to the question - that you want them to remain on the same page with no redirection, I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Be forewarned that the lead developer may request that you use the latest supported version 2.4.1 since you are now several version behind in updates.

    Cheers, Joe

  • Nauweb
    • WPMU DEV Initiate

    Hello Aecnu,

    recently I realized that I made a mistake, I thought that option 'Site URL' would redirect to home URL, I made confusion with the terms. Now I understand that the option 'Redirect on login' has two parts: first the base url and the second is the fragment of the url.

    What I need is for the user to remain in the requested URL.

    To better understand you can access the site, http://variavel5.com.br/, which is already in production server, if you login via the orange LOGIN button in the header, the wp_login_form function that I used to generate this form, will use the parameter 'redirect' = > site_url ($ _SERVER ['REQUEST_URI']) to keep you on the same page that you were.

    If you want to test you can loggin with username: wpmudev password: 12345

    I'd like to get something like that when the user login by Ultimate Facebook.

    If you have a quick tip even if I have to hack the code will help me a lot since the site is already released.

    Thanks a lot!

  • aecnu
    • WP Unicorn

    Greetings bruno_brant,

    Thank you for your additional input and clarification.

    Sorry for the delay here, somehow I missed your update to 2.4.1

    I will see if I can get the lead developer @Vladislav in here with his invaluable insight into this plugin for his advice/advise for us regarding the URL for the redirect.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Nauweb
    • WPMU DEV Initiate

    In function wdfb_get_login_redirect that handle redirect options there is a filter tagged as wdfb-login-redirect_url (thanks to lead developer @Vladislav), which allowed me to accomplish my goal.

    For others seeking the same solution put the code below in functions.php:

    add_filter( 'wdfb-login-redirect_url', 'nwb_redirect_login_fb' );
    
    function nwb_redirect_login_fb() {
    	$requested_url = site_url( $_SERVER['REQUEST_URI'] );
    	return $requested_url;
    }
  • Vladislav
    • Dead Eye Dev

    Hi,

    Thanks for the snippet! Another way of achieving the same thing if you don't have a redirection URL fragment set in plugin options, is to use a define:

    define('WDFB_EXACT_REDIRECT_URL_FALLBACK', true, true);

    Under the hood, this will work in a bit different way than $_SERVER['REQUEST_URI'] directly, but should act the same.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.