Bitrix Site Manager

CSubcription::IsAuthorized

CSubcription::IsAuthorized(
    $ID
);

The method IsAuthorized checks if the current user is authorized to access the subscription preferences.

Parameters

ParameterDescription
$ID The subscription ID.

Return Values

Returns true if the visitor is authorized to access the subscription preferences, or false otherwise.

Example



//check if we are already authorized to show password field
$bShowPass = true;
$aSubscr = CSubscription::GetUserSubscription();
if($aSubscr["ID"] > 0)
{
    //try to authorize user account's subscription
    if ($aSubscr["USER_ID"]>0 && 
        !CSubscription::IsAuthorized($aSubscr["ID"]))
    {
        CSubscription::Authorize($aSubscr["ID"], "");
    }

    //check authorization
    if (CSubscription::IsAuthorized($aSubscr["ID"]))
        $bShowPass = false;
}