You are here

function eck_author_property_entity_save in Entity Construction Kit (ECK) 7.2

Same name and namespace in other branches
  1. 7.3 plugins/property_behavior/author.inc \eck_author_property_entity_save()

When the entity is first saved, store the current user id as the author.

1 string reference to 'eck_author_property_entity_save'
author.inc in plugins/property_behavior/author.inc

File

plugins/property_behavior/author.inc, line 18

Code

function eck_author_property_entity_save($property, $vars) {
  $entity = $vars['entity'];
  if (isset($entity->is_new) && $entity->is_new && !isset($entity->{$property})) {
    global $user;
    $entity->{$property} = $user->uid;
  }
}