Page 1 of 1

First Time Logged In Conditional-Using Wp-FB AutoConnect

PostPosted: March 11th, 2011, 10:56 am
by Gayatriom
Hi!
I am using WP-FB Autoconnect and I'd like to redirect users who sign in with facebook to a payment page so they can buy the paid membership.
However, if I use the Login Welcome Page to connect this then they will ALWAYS get this page when they log in.
I only want to show this to them if they are logging in with FB for the first time.

How can I make this possible?

Re: First Time Logged In Conditional-Using Wp-FB AutoConnect

PostPosted: March 14th, 2011, 8:49 pm
by Jason Caldwell
Thanks for the excellent question.
I'm sorry, this is not something that is built into s2Member by default. However, you could certainly accomplish this with s2Member's Hook entitled: ws_plugin__s2member_during_login_redirect

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php

Do something like this inside the file:
Code: Select all
<?php
add_action 
("ws_plugin__s2member_during_login_redirect", "my_function");
function my_function ($vars = array ())
    {
        if (get_user_option ("one_time_offer_displayed", $vars["user_id"]) !== "yes")
            {
                $one_time_offer_url = "URL GOES HERE";
                /**/
                update_user_option ($vars["user_id"], "one_time_offer_displayed", "yes");
                wp_redirect ($one_time_offer_url);
                exit ();
            }
    }
?>