You are here

function _og_notifications_populate in Organic groups 5.3

Same name and namespace in other branches
  1. 5.8 og_notifications/og_notifications.install \_og_notifications_populate()
  2. 6.2 modules/og_notifications/og_notifications.install \_og_notifications_populate()
  3. 6 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 og_notifications/og_notifications.install
Implementation of hook_enable().

File

og_notifications/og_notifications.install, line 128

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);
  }
}