Advertisement:

Author Topic: Redirect new user register?  (Read 1092 times)

lonecrowlab

  • Jr. Member
  • **
  • Posts: 79
Redirect new user register?
« on: February 10, 2015, 12:46:21 pm »
I tried modifying this function found in OSCFacebook.php

Code: [Select]
                        require_once osc_lib_path() . 'osclass/UserActions.php';
                        $uActions = new UserActions( false );
                        $logged   = $uActions->bootstrap_login( $fbUser['fk_i_user_id'] );

                        switch( $logged ) {
                            case 0: osc_add_flash_error_message( __( 'The username doesn\'t exist', 'facebook' ) );
                            break;
                            case 1: osc_add_flash_error_message( __( 'The user has not been validated yet', 'facebook' ) );
                            break;
                            case 2: osc_add_flash_error_message( __( 'The user has been suspended', 'facebook' ) );
                            break;
                        }
                        return self::$facebook;
                    }
                }

                if( !isset(self::$user_profile['email']) ) {
                    osc_add_flash_error_message( __('Some error occured trying to connect with Facebook.', 'facebook') );
                    header( 'Location: ' . self::$logoutUrl );
                    exit();
                }

                $manager = User::newInstance();
                $oscUser = $manager->findByEmail( self::$user_profile['email'] );
                // exists on our DB, we merge both accounts
                if( count($oscUser) > 0 ) {
                    require_once osc_lib_path() . 'osclass/UserActions.php';
                    $uActions = new UserActions( false );

                    $manager->dao->from( $this->getTableName() );
                    $manager->dao->set( 'fk_i_user_id', $oscUser['pk_i_id'] );
                    $manager->dao->set( 'i_facebook_uid', self::$user_profile['id'] );
                    $manager->dao->insert();
                    osc_add_flash_ok_message( __( "You already have an user with this e-mail address. We've merged your accounts", 'facebook' ) );

                    // activate user in case is not activated
                    $manager->update( array('b_active' => '1')
                                     ,array('pk_i_id' => $oscUser['pk_i_id']) );
                    $logged = $uActions->bootstrap_login( $oscUser['pk_i_id'] );
                } else {
                    // Auto-register him
                    $this->register_user( self::$user_profile );
                    header('Location:'.osc_user_profile_url() );
                   osc_add_flash_ok_message('Please update your profile in order for the member to recognize you much better');
             
                }

                // redirect to log in
                header( 'Location: ' . osc_base_url() );
                exit;
            } catch (FacebookApiException $e) {
                self::$user = null;
            }

            return self::$facebook;
        }

Inserting this code if it will register

Code: [Select]
   // Auto-register him
                    $this->register_user( self::$user_profile );
                    header('Location:'.osc_user_profile_url() );
                   osc_add_flash_ok_message('Please update your profile in order for the member to recognize you much better');
             
                }

but with no luck. :(

frontend

  • Newbie
  • *
  • Posts: 7
Re: Redirect new user register?
« Reply #1 on: February 11, 2015, 12:10:02 am »
Facebook SDK updated for php 5.4 greater.. i have problem on facebook connect plugin and wait some solutiouns...

lonecrowlab

  • Jr. Member
  • **
  • Posts: 79
Re: Redirect new user register?
« Reply #2 on: February 11, 2015, 12:18:10 pm »
anyone?