Skip to content

Commit ebc4ddf

Browse files
authored
Merge pull request #365 from GM-Alex/next
Bump version 2.2.18
2 parents 7572698 + 9bb42df commit ebc4ddf

20 files changed

+148
-28
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "User Access Manager plugin for Wordpress",
44
"type": "wordpress-plugin",
55
"license": "GPL-2.0",
6-
"version": "2.2.17",
6+
"version": "2.2.18",
77
"authors": [
88
{
99
"name": "Alexander Schneider",

includes/language.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@
172172
define('TXT_UAM_SHOW_ASSIGNED_GROUPS_DESC', __('Show assigned groups next to the edit link', 'user-access-manager'));
173173
define('TXT_UAM_HIDE_EDIT_LINK_ON_NO_ACCESS', __('Hide edit link on no access', 'user-access-manager'));
174174
define('TXT_UAM_HIDE_EDIT_LINK_ON_NO_ACCESS_DESC', __('Hides the edit link if the user has no write access.', 'user-access-manager'));
175+
define('TXT_UAM_EXTRA_IP_HEADER', __('Extra IP header', 'user-access-manager'));
176+
define('TXT_UAM_EXTRA_IP_HEADER_DESC', __('Use this header for the user IP address if you are using a proxy. A valid value is for example HTTP_X_REAL_IP.', 'user-access-manager'));
175177

176178
// --- Setting Page -> default values ---
177179
define('TXT_UAM_SETTING_DEFAULT_NO_RIGHTS', __('No rights!', 'user-access-manager'));

init.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ function initUserAccessManger()
8080
$userGroupHandler = new UserGroupHandler(
8181
$wordpress,
8282
$wordpressConfig,
83+
$mainConfig,
8384
$database,
8485
$objectHandler,
8586
$userHandler,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "user-access-manager",
3-
"version": "2.2.17",
3+
"version": "2.2.18",
44
"description": "[![Build Status](https://travis-ci.org/GM-Alex/user-access-manager.svg)](https://travis-ci.org/GM-Alex/user-access-manager)",
55
"main": "index.js",
66
"directories": {

readme.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Contributors: GM_Alex
33
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=1947052
44
Tags: admin, access, member area, members, member, member access, page, pages, post, posts, private, privacy, restrict, user, user access manager, user management
55
Requires at least: 4.7
6-
Tested up to: 5.9
7-
Stable tag: 2.2.17
6+
Tested up to: 6.1
7+
Stable tag: 2.2.18
88

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

@@ -59,6 +59,13 @@ Here you found the changes in each version.
5959

6060
Version Date Changes
6161

62+
2.2.18 2022/11/14 Fix issue with label id. Thanks to elbakkali
63+
Add elementor support. Thanks to JboyJW
64+
Fix possible issue with PHP 8. Thanks to ollycross
65+
Fix attachment issue.
66+
Fix tags issue.
67+
Make extra IP header configurable.
68+
6269
2.2.17 2022/02/15 Fix issue with big picture handling. #350
6370

6471
2.2.16 2022/01/25 Check compatibility for Wordpress 5.9.
@@ -456,7 +463,7 @@ See: [https://github.com/GM-Alex/user-access-manager/wiki/FAQ](https://github.co
456463

457464
== Screenshots ==
458465

459-
1. The group manger.
466+
1. The group manager.
460467
2. The setting screen
461468
3. The setup screen.
462469
4. Integration into post overview.

src/Config/MainConfig.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ private function addDefaultGeneralConfigParameters(array &$configParameters)
109109
$id = 'hide_edit_link_on_no_access';
110110
$configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
111111

112+
$id = 'extra_ip_header';
113+
$configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id, 'HTTP_X_REAL_IP');
114+
112115
$id = 'protect_feed';
113116
$configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
114117

@@ -623,4 +626,12 @@ public function getActiveCacheProvider(): ?string
623626
{
624627
return $this->getParameterValue('active_cache_provider');
625628
}
629+
630+
/**
631+
* @return null|string
632+
*/
633+
public function getExtraIpHeader(): ?string
634+
{
635+
return $this->getParameterValue('extra_ip_header');
636+
}
626637
}

src/Controller/Backend/SettingsController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ private function getOtherSettingsForm(): Form
453453
'blog_admin_hint',
454454
'blog_admin_hint_text',
455455
'show_assigned_groups',
456-
'hide_edit_link_on_no_access'
456+
'hide_edit_link_on_no_access',
457+
'extra_ip_header'
457458
];
458459

459460
return $this->formHelper->getSettingsForm($parameters);

src/Controller/Frontend/FrontendController.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,25 @@ public function getWpSeoUrl($url, string $type, object $object)
137137
{
138138
return ($this->accessHandler->checkObjectAccess($type, $object->ID) === true) ? $url : false;
139139
}
140+
141+
/*
142+
* Elementor
143+
*/
144+
145+
/**
146+
* @param $content
147+
* @return mixed
148+
* @throws UserGroupTypeException
149+
*/
150+
public function getElementorContent($content)
151+
{
152+
$this->wordpress->removeAction('elementor/frontend/the_content', [$this, 'getElementorContent']);
153+
$post = $this->wordpress->getCurrentPost();
154+
155+
if ($this->accessHandler->checkObjectAccess($post->post_type, $post->ID) === false) {
156+
$content = htmlspecialchars_decode($this->mainConfig->getPostTypeContent($post->post_type));
157+
}
158+
159+
return $content;
160+
}
140161
}

src/File/FileHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ private function deliverFileViaFopen(string $file)
168168
*/
169169
private function deliverFile(string $file, bool $isInline)
170170
{
171+
header("HTTP/1.1 200 OK");
171172
$downloadType = $this->mainConfig->getDownloadType();
172173

173174
if ($downloadType === 'xsendfile') {

src/UserAccessManager.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
*/
5151
class UserAccessManager
5252
{
53-
const VERSION = '2.2.17';
53+
const VERSION = '2.2.18';
5454
const DB_VERSION = '1.6.1';
5555

5656
/**
@@ -692,6 +692,21 @@ public function addActionsAndFilters()
692692
$this->wordpress->addAction('wp_enqueue_scripts', [$frontendController, 'enqueueStylesAndScripts']);
693693
$this->wordpress->addFilter('get_ancestors', [$frontendController, 'showAncestors'], 20, 4);
694694
$this->wordpress->addFilter('wpseo_sitemap_entry', [$frontendController, 'getWpSeoUrl'], 1, 3);
695+
$this->wordpress->addFilter(
696+
'elementor/frontend/builder_content_data',
697+
function ($data, $postId) use ($frontendController) {
698+
if ($this->wordpress->getQueriedObjectId() === $postId) {
699+
$this->wordpress->addAction(
700+
'elementor/frontend/the_content',
701+
[$frontendController, 'getElementorContent']
702+
);
703+
}
704+
705+
return $data;
706+
},
707+
10,
708+
2
709+
);
695710

696711
// Post controller
697712
$frontendPostController = $this->controllerFactory->createFrontendPostController();

0 commit comments

Comments
 (0)