CakePHP-Facebook-Plugin icon indicating copy to clipboard operation
CakePHP-Facebook-Plugin copied to clipboard

How to check of beforeFacebookSave is being called?

Open timinho opened this issue 13 years ago • 0 comments

I have the feeling the beforeFacebookSave isn't been called. I need to save a user's email, firstname and lastname so what I do now is:

$fb_array = $this->Connect->user();

if( !empty($fb_array) ) {
  $this->loadModel('User');
  $facebookuser = $this->User->find('first',array('conditions' => array('User.facebook_id' => $this->Connect->user('id'))));

  if(!empty($facebookuser)) {
    echo "Saving";
    $userupdate['User']['id'] = $facebookuser['User']['id'];
    $userupdate['User']['group_id'] = 3;
    $userupdate['User']['last_login'] = date("Y-m-d H:i:s");
    $userupdate['User']['email'] = $this->Connect->user('email');
        $userupdate['User']['firstname'] = $this->Connect->user('first_name');
        $userupdate['User']['lastname'] = $this->Connect->user('last_name');
        if($this->User->save($userupdate,false)) {
          echo "Saved";
        }
  }
}

I prefer to do this in the same update/insert query from the plugin. Any suggestion?

//Edit I'm using php 5.3, cake 1.3 and the latest version of the plugin 3.3.1

timinho avatar Oct 19 '12 12:10 timinho