You are here

function biblio_get_orphan_author_ids in Bibliography Module 7

Get an array of author id's which are not associated with any biblio entries.

Return value

array

3 calls to biblio_get_orphan_author_ids()
biblio_count_orphan_authors in includes/biblio.contributors.inc
Get the number of orphaned authors in the database.
biblio_delete_orphan_authors in includes/biblio.contributors.inc
biblio_get_orphan_authors in includes/biblio.contributors.inc
Get an array of authors which are not associated with any biblio entires.

File

includes/biblio.contributors.inc, line 287

Code

function biblio_get_orphan_author_ids() {
  $orphans = array();
  $active_cids = array();
  $all_cids = array();
  $query = db_select('biblio_contributor', 'bc');
  $active_cids = $query
    ->fields('bc', array(
    'cid',
  ))
    ->groupBy('cid')
    ->execute()
    ->fetchCol();
  $query = db_select('biblio_contributor_data', 'bcd');
  $all_cids = $query
    ->fields('bcd', array(
    'cid',
  ))
    ->condition(db_and()
    ->condition('bcd.cid', 0, '>')
    ->condition('bcd.alt_form', 0, '='))
    ->execute()
    ->fetchCol();
  $orphans = array_diff($all_cids, $active_cids);
  return $orphans;
}