8000 Issue 456: Fix bug in uc_roles_revoke(). by bugfolder · Pull Request #457 · backdrop-contrib/ubercart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue 456: Fix bug in uc_roles_revoke(). #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions uc_roles/uc_roles.module
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ function uc_roles_delete($account, $role = NULL, $silent = FALSE) {
* @param bool $silent
* When set to TRUE will suppress any Backdrop messages from this function.
*/
function uc_roles_revoke(&$account, $role, $silent = FALSE) {
function uc_roles_revoke($account, $role, $silent = FALSE) {
global $user;

// Remove this role from the user's list.
Expand All @@ -1060,9 +1060,9 @@ function uc_roles_revoke(&$account, $role, $silent = FALSE) {
// Remove our record of the expiration.
uc_roles_delete($account, $role, $silent);

$role_name = db_query("SELECT name FROM {role} WHERE role = :role", array(':role' => $role))->fetchField();

if (!$silent) {
$role_load = user_role_load($role);
$role_name = $role_load->label;
if ($user->uid == $account->uid) {
backdrop_set_message(t('Your %role role has been revoked.', array('%role' => $role_name)));
}
Expand Down Expand Up @@ -1101,7 +1101,7 @@ function uc_roles_revoke(&$account, $role, $silent = FALSE) {
* @param bool $silent
* When set to TRUE will suppress any Backdrop messages from this function.
*/
function uc_roles_grant(&$account, $role, $timestamp, $save_user = TRUE, $silent = FALSE) {
function uc_roles_grant($account, $role, $timestamp, $save_user = TRUE, $silent = FALSE) {
global $user;

// First, delete any previous record of this user/role association.
Expand Down Expand Up @@ -1130,7 +1130,6 @@ function uc_roles_grant(&$account, $role, $timestamp, $save_user = TRUE, $silent
if (!$silent) {
$role_load = user_role_load($role);
$role_name = $role_load->label;

if ($user->uid == $account->uid) {
$message = t('You have been granted the %role role.', array('%role' => $role_name));
}
Expand Down
0