You are here

function _og_notifications_populate in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og_notifications/og_notifications.install \_og_notifications_populate()
  2. 5.3 og_notifications/og_notifications.install \_og_notifications_populate()
  3. 6.2 modules/og_notifications/og_notifications.install \_og_notifications_populate()

Populate the og_notifications_table with any uids added prior to installation or when disabled.

1 call to _og_notifications_populate()
og_notifications_enable in modules/og_notifications/og_notifications.install
Implementation of hook_enable().

File

modules/og_notifications/og_notifications.install, line 112

Code

function _og_notifications_populate() {
  $sql = 'SELECT u.uid FROM {users} u LEFT JOIN {og_notifications} ogn ON u.uid = ogn.uid WHERE u.uid > 0 AND ogn.uid IS NULL';
  $result = db_query($sql);
  while ($row = db_fetch_object($result)) {

    // autosubscribe is set to the column default.
    db_query("INSERT INTO {og_notifications} (uid) VALUES (%d)", $row->uid);
  }
}