/** * Optionally flag profile when a block happens * * We optionally add a flag when a profile has been blocked * * @param User $user User doing the block * @param Profile $profile Profile being blocked * * @return boolean hook result */ function onEndBlockProfile($user, $profile) { if ($this->flagOnBlock && !User_flag_profile::exists($profile->id, $user->id)) { User_flag_profile::create($user->id, $profile->id); } return true; }
/** * Handle POST * * @return void */ function handlePost() { $user = common_current_user(); assert(!empty($user)); assert(!empty($this->profile)); // throws an exception on error if (User_flag_profile::exists($this->profile->id, $user->id)) { // We'll return to the profile page (or return the updated AJAX form) // showing the current state, so no harm done. } else { User_flag_profile::create($user->id, $this->profile->id); } if ($this->boolean('ajax')) { $this->ajaxResults(); } }
/** * Handle POST * * @return void */ function handlePost() { $user = common_current_user(); assert(!empty($user)); assert(!empty($this->profile)); // throws an exception on error User_flag_profile::create($user->id, $this->profile->id); if ($this->boolean('ajax')) { $this->ajaxResults(); } }