applications/dashboard/controllers/class.profilecontroller.php
public function RemovePicture($UserReference = '', $Username = '', $TransientKey = '') {
      $this->Permission('Garden.SignIn.Allow');
      $Session = Gdn::Session();
      if (!$Session->IsValid())
         $this->Form->AddError('You must be authenticated in order to use this form.');
      
      // Get user data & another permission check
      $this->GetUserInfo($UserReference, $Username, '', TRUE);
      $RedirectUrl = UserUrl($this->User, '', 'picture');
      if ($Session->ValidateTransientKey($TransientKey)
         && is_object($this->User)
         && (
            $this->User->UserID == $Session->UserID
            || $Session->CheckPermission('Garden.Users.Edit')
         )
      ) {
         // Do removal, set message, redirect
         Gdn::UserModel()->RemovePicture($this->User->UserID);
         $this->InformMessage(T('Your picture has been removed.'));
      }
      if ($this->_DeliveryType == DELIVERY_TYPE_ALL) {
          Redirect($RedirectUrl);
      } else {
         $this->ControllerName = 'Home';
         $this->View = 'FileNotFound';
         $this->RedirectUrl = Url($RedirectUrl);
         $this->Render();
      }
   }
public function RemovePicture($UserReference = '', $Username = '', $TransientKey = '') {
      $this->Permission('Garden.SignIn.Allow');
      $Session = Gdn::Session();
      if (!$Session->IsValid())
         $this->Form->AddError('You must be authenticated in order to use this form.');
      
      // Get user data & another permission check
      $this->GetUserInfo($UserReference, $Username, '', TRUE);
      $RedirectUrl = UserUrl($this->User, '', 'picture');
      if ($Session->ValidateTransientKey($TransientKey)
         && is_object($this->User)
         && (
            $this->User->UserID == $Session->UserID
            || $Session->CheckPermission('Garden.Users.Edit')
         )
      ) {
         // Do removal, set message, redirect
         Gdn::UserModel()->RemovePicture($this->User->UserID);
         $this->InformMessage(T('Your picture has been removed.'));
      }
      if ($this->_DeliveryType == DELIVERY_TYPE_ALL) {
          Redirect($RedirectUrl);
      } else {
         $this->ControllerName = 'Home';
         $this->View = 'FileNotFound';
         $this->RedirectUrl = Url($RedirectUrl);
         $this->Render();
      }
   }
public function RemovePicture ( $ UserReference = '' , $ Username = '' , $ TransientKey = '' ) { $ this -> Permission ( 'Garden.SignIn.Allow' ) ; $ Session = Gdn :: Session ( ) ; if ( ! $ Session -> IsValid ( ) ) $ this -> Form -> AddError ( 'You must be authenticated in order to use this form.' ) ; // Get user data & another permission check $ this -> GetUserInfo ( $ UserReference , $ Username , '' , TRUE ) ; $ RedirectUrl = UserUrl ( $ this -> User , '' , 'picture' ) ; if ( $ Session -> ValidateTransientKey ( $ TransientKey ) && is_object ( $ this -> User ) && ( $ this -> User -> UserID == $ Session -> UserID || $ Session -> CheckPermission ( 'Garden.Users.Edit' ) ) ) { // Do removal, set message, redirect Gdn :: UserModel ( ) -> RemovePicture ( $ this -> User -> UserID ) ; $ this -> InformMessage ( T ( 'Your picture has been removed.' ) ) ; } if ( $ this -> _DeliveryType == DELIVERY_TYPE_ALL ) { Redirect ( $ RedirectUrl ) ; } else { $ this -> ControllerName = 'Home' ; $ this -> View = 'FileNotFound' ; $ this -> RedirectUrl = Url ( $ RedirectUrl ) ; $ this -> Render ( ) ; } }
Remove the user's photo.

@since 2.0.0
@access public
@param mixed $UserReference Unique identifier, possibly username or ID.
@param string $Username.
@param string $TransientKey Security token.
Remove the user s photo .