You are here

function node_limit_user_node_limit_save in Node Limit 6

Same name and namespace in other branches
  1. 8 old/node_limit_user/node_limit_user.module \node_limit_user_node_limit_save()
  2. 7 node_limit_user/node_limit_user.module \node_limit_user_node_limit_save()

Implementation of hook_node_limit_save().

File

node_limit_user/node_limit_user.module, line 98
Module to restrict the number of nodes by user.

Code

function node_limit_user_node_limit_save($lid, $applies, $element) {
  if ($applies) {

    // $element contains the username of the user
    // user_load based on the name to get the uid
    $user = user_load(array(
      'name' => $element,
    ));
    $uid = $user->uid;
    db_query("INSERT INTO {node_limit_user} VALUES('%d', '%d')", $lid, $uid);
  }
}