You are here

function simplenews_roles_nodeapi in Simplenews Roles 6.2

Same name and namespace in other branches
  1. 5 simplenews_roles.module \simplenews_roles_nodeapi()
  2. 6 simplenews_roles.module \simplenews_roles_nodeapi()

Implementation of hook_nodeapi().

File

./simplenews_roles.module, line 227
Simplenews Roles module

Code

function simplenews_roles_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if (in_array($node->type, variable_get('simplenews_content_types', array(
    'simplenews',
  )))) {
    switch ($op) {
      case 'insert':
      case 'update':

        // Strip out non-Simplenews terms from taxonomy for posterity.
        $term = simplenews_validate_taxonomy($node->taxonomy);
        $tid = is_array($term) ? array_shift(array_values($term)) : 0;
        $role_newsletters = variable_get('simplenews_roles_tids_rids', array());
        if (isset($role_newsletters[$tid])) {

          //simplenews_roles_update_subscriptions($tid, $role_newsletters[$tid]);

          // TODO
          // Why do we need to sync here?
        }
        break;
    }
  }
}