Bitrix Site Manager

CSubcription::GetList

CSubcription::GetList(
    $aSort=array(), 
    $aFilter=array()
);

The method GetList returns a filtered list of subscriptions.

Parameters

ParameterDescription
$aSort Array containing the sort criteria entries in the form of "field name"=>"direction".

The field name can be the following:
  • ID - the subscription ID;
  • DATE_INSERT - the date the subscription was added;
  • ACT - active state flag;
  • CONF - confirmation state flag;
  • EMAIL - e-mail address of the subscription;
  • FMT - format of the subscription message;
  • USER - the used ID.
The direction can be one of the following:
  • ASC - ascending;
  • DESC - descending.
For example: 
array("EMAIL"=>"ASC", "ACT"=>"DESC")
$aFilter Array containing the filter entries in the form "field name"=>"filter value".

The field name can be the following:
  • ID - the subscription ID (complex logic allowed);
  • EMAIL - e-mail address (complex logic allowed);
  • UPDATE_1 - the earliest possible date of modification;
  • UPDATE_2 - the latest possible date of modification;
  • INSERT_1 - the earliest possible date of subscription adding;
  • INSERT_2 - the latest possible date of subscription adding;
  • USER - the user (complex logic allowed in fields ID, LOGIN, NAME, LAST_NAME);
  • USER_ID - the user ID (complex logic allowed);
  • ANONYMOUS - flag indicating the subscription is anonymous;
  • CONFIRMED - flag indicating the subscription is confirmed;
  • ACTIVE - the subscription active state flag;
  • FORMAT - the subscription format;
  • RUBRIC - the subscription rubrics in the form of an array of ID's and a string built using the filter logic rules.
For example: 
array("CONFIRMED"=>"Y", "ACTIVE"=>"Y")

Return Values

Returns an instance of the CDBResult class. The Subscription object fields become available after calling one of the CDBResult methods.

Example



//selects rubrics to which message is to be sent
$aPostRub = array();
$post_rub = CPostingGeneral::GetRubricList($post_arr["ID"]);
while($post_rub_arr = $post_rub->Fetch())
    $aPostRub[] = $post_rub_arr["ID"];

//active and confirmed e-mail addresses subscribed to rubrics
$subscr = CSubscription::GetList(
    array("ID"=>"ASC"), 
    array("RUBRIC"=>$aPostRub, "CONFIRMED"=>"Y", "ACTIVE"=>"Y", 
        "FORMAT"=>$post_arr["SUBSCR_FORMAT"], "EMAIL"=>$post_arr["EMAIL_FILTER"])
);
while(($subscr_arr = $subscr->Fetch()))
    $aEmail[] = $subscr_arr["EMAIL"];