You are here

function pmpapi_update_subscribe_client in Public Media Platform API Integration 7

1 call to pmpapi_update_subscribe_client()
pmpapi_update_config_form in pmpapi_update/pmpapi_update.admin.inc

File

pmpapi_update/pmpapi_update.admin.inc, line 50

Code

function pmpapi_update_subscribe_client($topic) {
  $topic_uri = pmpapi_update_get_topic_uri($topic);
  $update = new PMPAPIDrupalUpdate($topic_uri, 'subscribe');
  $pending = array(
    'verify_token' => $update->verify_token,
    'mode' => $update->mode,
    'topic_uri' => $topic_uri,
  );
  variable_set('pmpapi_update_subscribe_pending', $pending);
  $update
    ->sendRequestToHub();
  if ($update->response->code == 204) {
    variable_set('pmpapi_update_subscribed_to_' . $topic, TRUE);
  }
  variable_del('pmpapi_update_subscribe_pending');
}