function _instagram_feeds_moderation_get_feeds_query in Instagram Feeds 7
Helper function for finding all instagram feeds and their terms.
Return value
array array of objects that contain feed nid, feed name, user_tids and tag_tids.
3 calls to _instagram_feeds_moderation_get_feeds_query()
- instagram_feeds_moderation_get_feeds in modules/
instagram_feeds_moderation/ instagram_feeds_moderation.module - Returns an associative array of instagram feeds for specified tags and users.
- instagram_feeds_moderation_get_tagnames in modules/
instagram_feeds_moderation/ instagram_feeds_moderation.module - Returns array of hash tags for a specyfied Instagram Feed.
- instagram_feeds_moderation_get_usernames in modules/
instagram_feeds_moderation/ instagram_feeds_moderation.module - Returns array of users for a specyfied Instagram Feed.
File
- modules/
instagram_feeds_moderation/ instagram_feeds_moderation.module, line 463
Code
function _instagram_feeds_moderation_get_feeds_query() {
$result =& drupal_static(__FUNCTION__);
if (!isset($result)) {
$result = array();
$q = db_select('node', 'n')
->fields('n', array(
'nid',
'title',
));
$q
->leftJoin('field_data_field_instf_hash_tags', 'tags', 'n.nid = tags.entity_id');
$q
->leftJoin('field_data_field_instf_user', 'users', 'n.nid = users.entity_id');
$q
->leftJoin('taxonomy_term_data', 'term', 'tags.field_instf_hash_tags_tid = term.tid');
$q
->leftJoin('taxonomy_term_data', 'uterm', 'users.field_instf_user_tid = uterm.tid');
$q
->addExpression("GROUP_CONCAT(tags.field_instf_hash_tags_tid ORDER BY tags.field_instf_hash_tags_tid)", 'tag_tids');
$q
->addExpression("GROUP_CONCAT(term.name ORDER BY term.tid)", 'tag_names');
$q
->addExpression("GROUP_CONCAT(users.field_instf_user_tid ORDER BY users.field_instf_user_tid)", 'user_tids');
$q
->addExpression("GROUP_CONCAT(uterm.name ORDER BY uterm.tid)", 'user_names');
$q
->condition('n.type', INSTAGRAM_FEEDS_SETTINGS_NODE_TYPE);
$q
->groupBy('n.nid');
$q
->orderBy('n.title');
$result = $q
->execute()
->fetchAllAssoc('nid');
}
return $result;
}