Results 1 to 3 of 3

Thread: Trying to get oneall social login working with classipress

  1. #1
    Thread Starter
    Veteran bleem's Avatar
    Join Date
    Feb 2012
    Posts
    1,571
    Thanks
    103
    Thanked 205 Times in 180 Posts

    Trying to get oneall social login working with classipress

    Hi,

    Can anyone help with this please.

    I am trying to get oneall social login working with classipress.

    The plugin works so much that it logs into facebook or takes the facebook parameters for the user but when it redirects back to classipress it stays on the login page and the user isn't logged in.

    This is the code that makes the redirect but it just isn't working.

    It looks like it should but I am positive its some classipress hook which is causing it to not work.


    Code:
    //Sucess
                        $user_data = get_userdata ($user_id);
                        if ($user_data !== false)
                        {
                            //Setup Cookie
                            wp_clear_auth_cookie();
                            wp_set_auth_cookie ($user_data->ID, true);
                            do_action('wp_login', $user_data->user_login, $user_data);
    
    
                            //Where did the user come from?
                            $oa_social_login_source = (!empty ($_REQUEST ['oa_social_login_source']) ? strtolower (trim ($_REQUEST ['oa_social_login_source'])) : '');
    
    
                            //Use safe redirection?
                            $redirect_to_safe = false;
    
    
                            //Build the url to redirect the user to
                            switch ($oa_social_login_source)
                            {
                                //*************** Registration ***************
                                case 'registration':
    
    
                                    //Default redirection
                                    $redirect_to = admin_url ();
    
    
                                    //Redirection customized
                                    if (isset ($settings ['plugin_registration_form_redirect']))
                                    {
                                        switch (strtolower ($settings ['plugin_registration_form_redirect']))
                                        {
                                            //Homepage
                                            case 'homepage':
                                                $redirect_to = home_url ();
                                            break;
    
    
                                            //Custom
                                            case 'custom':
                                                if (isset ($settings ['plugin_registration_form_redirect_custom_url']) AND strlen (trim ($settings ['plugin_registration_form_redirect_custom_url'])) > 0)
                                                {
                                                    $redirect_to = trim ($settings ['plugin_registration_form_redirect_custom_url']);
                                                }
                                            break;
    
    
                                            //Default/Dashboard
                                            default:
                                            case 'dashboard':
                                                $redirect_to = admin_url ();
                                            break;
                                        }
                                    }
                                break;
    
    
    
    
                                //*************** Login ***************
                                case 'login':
                                    //Default redirection
                                    $redirect_to = wp_login_url();
    
    
                                    //Redirection in URL
                                    if (!empty ($_GET ['redirect_to']))
                                    {
                                        $redirect_to = $_GET ['redirect_to'];
                                        $redirect_to_safe = true;
                                    }
                                    else
                                    {
                                        //Redirection customized
                                        if (isset ($settings ['plugin_login_form_redirect']))
                                        {
                                            switch (strtolower ($settings ['plugin_login_form_redirect']))
                                            {
                                                //Dashboard
                                                case 'dashboard':
                                                    $redirect_to = admin_url ();
                                                break;
    
    
                                                //Custom
                                                case 'custom':
                                                    if (isset ($settings ['plugin_login_form_redirect_custom_url']) AND strlen (trim ($settings ['plugin_login_form_redirect_custom_url'])) > 0)
                                                    {
                                                        $redirect_to = trim ($settings ['plugin_login_form_redirect_custom_url']);
                                                    }
                                                break;
    
    
                                                //Default/Homepage
                                                default:
                                                case 'homepage':
                                                    $redirect_to = home_url ();
                                                break;
                                            }
                                        }
                                    }
                                break;
    
    
                                // *************** Comments ***************
                                case 'comments':
                                    $redirect_to = oa_social_login_get_current_url () . '#comments';
                                break;
    
    
                                //*************** Widget/Shortcode ***************
                                default:
                                case 'widget':
                                case 'shortcode':
                                    // This is a new user
                                    $opt_key = ($new_registration === true ? 'register' : 'login');
    
    
                                    //Default value
                                    $redirect_to = oa_social_login_get_current_url ();
    
    
                                    //Redirection customized
                                    if (isset ($settings['plugin_shortcode_' . $opt_key . '_redirect']))
                                    {
                                        switch (strtolower ($settings['plugin_shortcode_' . $opt_key . '_redirect']))
                                        {
                                            //Current
                                            case 'current':
                                                $redirect_to = oa_social_login_get_current_url ();
                                            break;
    
    
                                            //Homepage
                                            case 'homepage':
                                                $redirect_to = home_url ();
                                            break;
    
    
                                            //Dashboard
                                            case 'dashboard':
                                                $redirect_to = admin_url ();
                                            break;
    
    
                                            //Custom
                                            case 'custom':
                                                if (isset ($settings['plugin_shortcode_' . $opt_key . '_redirect_url']) AND strlen (trim ($settings['plugin_shortcode_' . $opt_key . '_redirect_url'])) > 0)
                                                {
                                                    $redirect_to = trim ($settings['plugin_shortcode_' . $opt_key . '_redirect_url']);
                                                }
                                            break;
                                        }
                                    }
                                break;
                            }
    
    
                            //Check if url set
                            if (!isset ($redirect_to) OR strlen (trim ($redirect_to)) == 0)
                            {
                                $redirect_to = home_url ();
                            }
    
    
                            //Use safe redirection
                            if ($redirect_to_safe === true)
                            {
                                wp_safe_redirect ($redirect_to);
                            }
                            else
                            {
                                wp_redirect ($redirect_to);
                            }
                            exit ();
                        }
    Am I missing something here?
    Do I need to add something to the redirect settings to make this redirect to the correct places?

    Any help would be very appreciated.
    Regards

  2. #2
    Thread Starter
    Veteran bleem's Avatar
    Join Date
    Feb 2012
    Posts
    1,571
    Thanks
    103
    Thanked 205 Times in 180 Posts

    Solved

    I have fixed this now with the help from the developer and oneall social login works perfectly with my version of classipress now.

    Classipress 3.1.9
    word press 3.4.1 multisite with sub domains
    Plugin url - http://docs.oneall.com/plugins/guide...gin-wordpress/

    Please note that I am using a multisite version of the plugin rather than the standard plugin.
    This fix will probably work on standard wordpress installs too.

    It is still a work in progress but appears to be bug free at the moment.
    The reason I wanted this specific plugin to work was because it works with wp-multisite and my sub-domain set up.

    I'm not sure if it works with subfolder multisite installs though.

    THE FIX:

    Code:
    open the file oa-social-login.php of the Social Login plugin and replace this line:
    
    add_action ('init', 'oa_social_login_init', 2000);
    
    With the following line:
    
    add_action ('init', 'oa_social_login_init', 50);
    Hope this helps

  3. #3
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,958
    Thanks
    169
    Thanked 3,405 Times in 3,276 Posts
    Thanks for sharing your solution bleem.

    Anyway, I am moving this thread to the Plugin Exchange section so that users with the same issue could this find thread easily.

    Have a nice day.
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add Social Login Option on Admin Bar Login Form
    By marcomarco in forum Report Vantage Bugs (Legacy)
    Replies: 1
    Last Post: September 3rd, 2012, 12:08 PM
  2. Add Social Login Option on Admin Bar Login Form
    By marcomarco in forum Vantage General Discussion (Legacy)
    Replies: 1
    Last Post: September 2nd, 2012, 09:37 PM
  3. [SOLVED] Does Jobroller work with Oneall the social login?
    By fodia in forum Help Using JobRoller
    Replies: 1
    Last Post: July 11th, 2012, 09:31 AM