function newsletter_get_default_exposed in Newsletter 7
Same name and namespace in other branches
- 7.2 newsletter.module \newsletter_get_default_exposed()
Get a subscriber's exposed terms.
1 call to newsletter_get_default_exposed()
- newsletter_field_attach_form in ./
newsletter.module - Implements hook_field_attach_form().
File
- ./
newsletter.module, line 1231 - Defines menu items for newsletter administration, permissions and basic drupal hooks.
Code
function newsletter_get_default_exposed($subscriber, $list) {
if (!isset($subscriber->nsid)) {
return array();
}
$tids = db_query('SELECT target_id_tids
FROM {field_data_field_newsletter_list}
WHERE entity_id = :nsid
AND field_newsletter_list_target_id = :nlid', array(
':nsid' => $subscriber->nsid,
':nlid' => $list->nlid,
))
->fetchField();
if ($tids) {
$tids = @unserialize($tids);
if (is_array($tids)) {
foreach ($tids as $tid) {
$defaults[$tid] = $tid;
}
}
}
return isset($defaults) ? $defaults : array();
}