You are here

function _invite_add_permission in Invite 5

Same name and namespace in other branches
  1. 5.2 invite.install \_invite_add_permission()
  2. 6.2 invite.install \_invite_add_permission()
  3. 7.2 invite.install \_invite_add_permission()

Helper function to add a permission to a role.

2 calls to _invite_add_permission()
invite_update_11 in ./invite.install
Add track permission to all roles that currently have send permission.
invite_update_9 in ./invite.install
Update limit and move some settings to the premissions table.

File

./invite.install, line 91

Code

function _invite_add_permission($rid, $permission) {
  if ($permission) {
    $current_perm = db_result(db_query("SELECT perm FROM {permission} WHERE rid = %d", $rid));
    if ($current_perm != '') {
      $current_perm .= ', ';
    }
    $current_perm .= $permission;
    db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $current_perm, $rid);
  }
}