Bitrix Site Manager

CFormResult::SetStatus

bool
CFormResult::SetStatus(
 int result_id,
 int status_id,
 string check_rights = "Y"
)

The method SetStatus assigns a new status to a result.

Parameters

Parameter Description
result_id The result ID.
status_id The new status ID.
check_rights Specifies that the current user access permissions should be checked.

The following values are possible:
  • Y - permissions should be checked;
  • N - do not check permissions should not be checked.
The following permissions are required for the new status to be assigned successfully:
  1. For the web form to which the result being edited belongs:

    [20] Handle all results according to their status

    or, if you are the author of the status to be deleted, the following permission is sufficiet:

    [15] Handle own result according to its status
  2. For the status in which the currently edited result is:

    [EDIT] edit
  3. For the new status status_id:

    [MOVE] move results to this status
Optional. "Y" by default (check permissions).

Return Values

Returns true on success, or false otherwise.

Example



<?
$RESULT_ID = 189; // the result ID
$STATUS_ID = 1; // the ID of the status "Published"

// assign a new status to a result
// check current user permissions
if (CFormResult::SetStatus($RESULT_ID, $STATUS_ID))
{
    echo "Status #".$STATUS_ID." for result #".$RESULT_ID." successfully set.";
}
else // error
{
    global $strError;
    echo $strError;
}
?>