UserModel::decline PHP Method

decline() public method

Decline a user's application to join the forum.
public decline ( integer $UserID ) : boolean
$UserID integer
return boolean
    public function decline($UserID)
    {
        $applicantRoleIDs = RoleModel::getDefaultRoles(RoleModel::TYPE_APPLICANT);
        // Make sure the user is an applicant
        $RoleData = $this->getRoles($UserID);
        if ($RoleData->numRows() == 0) {
            throw new Exception(t('ErrorRecordNotFound'));
        } else {
            $AppRoles = $RoleData->result(DATASET_TYPE_ARRAY);
            $ApplicantFound = false;
            foreach ($AppRoles as $AppRole) {
                if (in_array(val('RoleID', $AppRole), $applicantRoleIDs)) {
                    $ApplicantFound = true;
                }
            }
        }
        if ($ApplicantFound) {
            $this->delete($UserID);
        }
        return true;
    }
UserModel