Skip to content

Commit

Permalink
Merge pull request #332 from GM-Alex/next
Browse files Browse the repository at this point in the history
Bump version 2.2.12
  • Loading branch information
GM-Alex authored Apr 14, 2021
2 parents 20692eb + 7f07ff3 commit 445fc05
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assets/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jQuery(document).ready(function ($) {
}
};

$inputs.change(function () {
$inputs.on('change', function () {
toggleElement(this);
});

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "User Access Manager plugin for Wordpress",
"type": "wordpress-plugin",
"license": "GPL-2.0",
"version": "2.2.11",
"version": "2.2.12",
"authors": [
{
"name": "Alexander Schneider",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "user-access-manager",
"version": "2.2.11",
"version": "2.2.12",
"description": "[![Build Status](https://travis-ci.org/GM-Alex/user-access-manager.svg)](https://travis-ci.org/GM-Alex/user-access-manager)",
"main": "index.js",
"directories": {
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: admin, access, member area, members, member, member access, page, pages, post, posts, private, privacy, restrict, user, user access manager, user management
Requires at least: 4.7
Tested up to: 5.7
Stable tag: 2.2.11
Stable tag: 2.2.12

With the "User Access Manager"-plugin you can manage the access to your posts, pages and files.

Expand Down Expand Up @@ -59,6 +59,9 @@ Here you found the changes in each version.

Version Date Changes

2.2.12 2021/04/14 Fix warning.
Fix jquery deprecation warning.

2.2.11 2021/03/15 Type fix for showEditLink.
Set compatibility tag for wordpress 5.7.

Expand Down
3 changes: 2 additions & 1 deletion src/Access/AccessHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ public function checkObjectAccess(?string $objectType, $objectId, $isAdmin = nul
} else {
$membership = $this->userGroupHandler->getUserGroupsForObject($objectType, $objectId);
$access = $membership === []
|| array_intersect_key($membership, $this->getUserUserGroupsForObjectAccess($isAdmin)) !== [];
|| array_intersect_key($membership, $this->getUserUserGroupsForObjectAccess($isAdmin)) !== []
&& $this->wordpress->isUserMemberOfBlog();
}

$this->objectAccess[$isAdmin][$objectType][$objectId] = $access;
Expand Down
2 changes: 1 addition & 1 deletion src/UserAccessManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
*/
class UserAccessManager
{
const VERSION = '2.2.11';
const VERSION = '2.2.12';
const DB_VERSION = '1.6.1';

/**
Expand Down
11 changes: 10 additions & 1 deletion src/Wrapper/Wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public function isAdmin(): bool
//So let's check if we are calling the ajax data for the frontend or backend
//If the referer is an admin url we are requesting the data for the backend
$adminUrl = get_admin_url();
return (substr((string) $_SERVER['HTTP_REFERER'], 0, strlen((string) $adminUrl)) === $adminUrl);
return (substr((string) ($_SERVER['HTTP_REFERER'] ?? ''), 0, strlen((string) $adminUrl)) === $adminUrl);
}

//No ajax request just use the normal function
Expand Down Expand Up @@ -1020,4 +1020,13 @@ public function gotModRewrite(): bool

return got_mod_rewrite();
}

/**
* @return bool
* @see \is_user_member_of_blog()
*/
public function isUserMemberOfBlog(): bool
{
return (bool) is_user_member_of_blog();
}
}
4 changes: 4 additions & 0 deletions tests/Unit/Access/AccessHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public function testCheckObjectAccess()
true
));

$wordpress->expects($this->exactly(2))
->method('isUserMemberOfBlog')
->will($this->returnValue(true));

$mainConfig = $this->getMainConfig();

$mainConfig->expects($this->exactly(7))
Expand Down
2 changes: 1 addition & 1 deletion user-access-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: User Access Manager
* Plugin URI: https://wordpress.org/plugins/user-access-manager/
* Author URI: https://twitter.com/GM_Alex
* Version: 2.2.11
* Version: 2.2.12
* Requires PHP: 7.2
* Author: Alexander Schneider
* Description: Manage the access to your posts, pages, categories and files.
Expand Down

0 comments on commit 445fc05

Please sign in to comment.