function hook_node_limit_save in Node Limit 7
Same name and namespace in other branches
- 8 old/node_limit.api.php \hook_node_limit_save()
Save submodules' data.
Called when saving a node limit for each submodule individually.
Parameters
int $lid: The node limit id
bool $applies: TRUE if this submodule have been chosen
mixed $element: The form element value
5 functions implement hook_node_limit_save()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- node_limit_interval_node_limit_save in node_limit_interval/
node_limit_interval.module - Implements hook_node_limit_save().
- node_limit_role_node_limit_save in node_limit_role/
node_limit_role.module - Implements hook_node_limit_save().
- node_limit_type_node_limit_save in node_limit_type/
node_limit_type.module - Implements hook_node_limit_save().
- node_limit_userofrole_node_limit_save in node_limit_userofrole/
node_limit_userofrole.module - Implements hook_node_limit_save().
- node_limit_user_node_limit_save in node_limit_user/
node_limit_user.module - Implements hook_node_limit_save().
1 invocation of hook_node_limit_save()
- node_limit_save in ./
node_limit.module - Callback to save a node limit back to the database.
File
- ./
node_limit.api.php, line 173 - Node_limit api reference.
Code
function hook_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_by_name($element);
db_insert('submodule')
->fields(array(
'lid' => $lid,
'uid' => $user->uid,
))
->execute();
}
}