mollom_entity_update

  1. drupal
    1. 7 mollom.module function
Drupal 7 mollom_entity_update($entity, $type)

Implements hook_entity_update().

File

sites/all/modules/mollom/mollom.module, line 2442
Main Mollom integration module functions.

Code

function mollom_entity_update($entity, $type) {
  // If an existing entity is published and we have session data stored for it,
  // mark the data as moderated.
  $update = FALSE;
  // If the entity update function provides the original entity, only mark the
  // data as moderated when the entity's status transitioned to published.
  if (isset($entity->original->status)) {
    if (empty($entity->original->status) && !empty($entity->status)) {
      $update = TRUE;
    }
  }
  // If there is no original entity to compare against, check for the current
  // status only.
  elseif (!empty($entity->status)) {
    $update = TRUE;
  }
  if ($update) {
    list($id) = entity_extract_ids($type, $entity);
    mollom_data_moderate($type, $id);
  }
}