Documentation

IsAuthorized

bool
CSubscription::IsAuthorized(
    int ID
);

Method verifies, if current user is authorized for accessing subscription details. Static method.

Parameters

ParameterDescriptionAvailable from version
ID Subscription ID.

Returned value

Returns true If visitor is authorized for accessing this subscription, otherwise returns false.

Example

//check whether 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;
}


© «Bitrix24», 2001-2024
Up