mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-18 14:13:46 +09:00
Merge pull request #1521 from ultimatemember/development/2.8.x
Version 2.8.7
This commit is contained in:
@@ -44,7 +44,7 @@ GNU Version 2 or Any Later Version
|
||||
|
||||
### IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION
|
||||
|
||||
[Official Release Version: 2.8.6](https://github.com/ultimatemember/ultimatemember/releases/tag/2.8.6).
|
||||
[Official Release Version: 2.8.7](https://github.com/ultimatemember/ultimatemember/releases/tag/2.8.7).
|
||||
|
||||
## Changelog
|
||||
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
.um-admin.users-php .um_account_status {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: stretch;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.um-admin.users-php .um_account_status span {
|
||||
margin: 0 0 2px 0;
|
||||
padding: 0;
|
||||
}
|
||||
.um-admin.users-php .um_account_status ul {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
column-gap: 4px;
|
||||
row-gap: 0;
|
||||
margin: 0 0 4px 0;
|
||||
padding: 0;
|
||||
}
|
||||
.um-admin.users-php .um_account_status ul li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.um-admin.users-php .um_account_status ul li a.um-set-status-rejected, .um-admin.users-php .um_account_status ul li a.um-deactivate-user {
|
||||
color: #b32d2e;
|
||||
}
|
||||
.um-admin.users-php .um_account_status ul li a.um-set-status-rejected:active, .um-admin.users-php .um_account_status ul li a.um-set-status-rejected:hover, .um-admin.users-php .um_account_status ul li a.um-deactivate-user:active, .um-admin.users-php .um_account_status ul li a.um-deactivate-user:hover {
|
||||
color: #b32d2e;
|
||||
}
|
||||
|
||||
.um-admin.users-php .subsubsub li.subsep {
|
||||
display: block;
|
||||
visibility: hidden;
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
.um-admin.users-php .subsubsub li.subsep{display:block;visibility:hidden;height:0}.um-admin-modal .um-admin-infobox label{font-weight:700;display:block;color:#333;cursor:default}.um-admin-modal .um-admin-infobox p{color:#666;padding-top:15px}.um-admin-modal .um-admin-infobox>p:not(:first-child){border-top:1px solid #e5e5e5}.um-admin-modal .um-admin-infobox>p:first-child{margin-top:0;padding-top:0}.um-admin-modal .um-admin-infobox>.um-row>p{border-top:1px solid #e5e5e5}.um-admin-modal .um-admin-infobox>.um-row>p:last-child{margin-bottom:0}#UM_preview_registration .um-admin-modal-foot{display:none}
|
||||
.um-admin.users-php .um_account_status{display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;flex-wrap:nowrap}.um-admin.users-php .um_account_status span{margin:0 0 2px 0;padding:0}.um-admin.users-php .um_account_status ul{display:flex;flex-direction:row;justify-content:flex-start;align-items:baseline;flex-wrap:wrap;column-gap:4px;row-gap:0;margin:0 0 4px 0;padding:0}.um-admin.users-php .um_account_status ul li{margin:0;padding:0}.um-admin.users-php .um_account_status ul li a.um-deactivate-user,.um-admin.users-php .um_account_status ul li a.um-set-status-rejected{color:#b32d2e}.um-admin.users-php .um_account_status ul li a.um-deactivate-user:active,.um-admin.users-php .um_account_status ul li a.um-deactivate-user:hover,.um-admin.users-php .um_account_status ul li a.um-set-status-rejected:active,.um-admin.users-php .um_account_status ul li a.um-set-status-rejected:hover{color:#b32d2e}.um-admin.users-php .subsubsub li.subsep{display:block;visibility:hidden;height:0}.um-admin-modal .um-admin-infobox label{font-weight:700;display:block;color:#333;cursor:default}.um-admin-modal .um-admin-infobox p{color:#666;padding-top:15px}.um-admin-modal .um-admin-infobox>p:not(:first-child){border-top:1px solid #e5e5e5}.um-admin-modal .um-admin-infobox>p:first-child{margin-top:0;padding-top:0}.um-admin-modal .um-admin-infobox>.um-row>p{border-top:1px solid #e5e5e5}.um-admin-modal .um-admin-infobox>.um-row>p:last-child{margin-bottom:0}#UM_preview_registration .um-admin-modal-foot{display:none}
|
||||
@@ -1,5 +1,28 @@
|
||||
@import "selectors"
|
||||
@import "mixins"
|
||||
|
||||
.#{$prefix}admin.users-php
|
||||
.um_account_status
|
||||
+flex( column, flex-start, stretch, nowrap )
|
||||
span
|
||||
margin: 0 0 2px 0
|
||||
padding: 0
|
||||
ul
|
||||
+flex( row, flex-start, baseline, wrap )
|
||||
column-gap: 4px
|
||||
row-gap: 0
|
||||
margin: 0 0 4px 0
|
||||
padding: 0
|
||||
li
|
||||
margin: 0
|
||||
padding: 0
|
||||
a
|
||||
&.um-set-status-rejected,
|
||||
&.um-deactivate-user
|
||||
color: #b32d2e
|
||||
&:active,
|
||||
&:hover
|
||||
color: #b32d2e
|
||||
.#{$prefix}admin.users-php
|
||||
.subsubsub
|
||||
li.subsep
|
||||
|
||||
@@ -186,7 +186,7 @@ div.uimob340 .um-header .um-profile-meta {
|
||||
|
||||
div.uimob340 .um-header.no-cover .um-profile-meta {padding-top: 0 !important}
|
||||
|
||||
div.uimob340 .um-header .um-name {
|
||||
div.uimob340 .um-header .um-name {
|
||||
float: none !important;
|
||||
margin-right: 0 !important;
|
||||
font-size: 18px;
|
||||
@@ -388,7 +388,7 @@ div.uimob500 .um-header .um-profile-meta {
|
||||
|
||||
div.uimob500 .um-header.no-cover .um-profile-meta {padding-top: 0 !important}
|
||||
|
||||
div.uimob500 .um-header .um-name {
|
||||
div.uimob500 .um-header .um-name {
|
||||
float: none !important;
|
||||
margin-right: 0 !important;
|
||||
font-size: 21px;
|
||||
@@ -636,7 +636,7 @@ div.uimob960 .um-profile-photo a.um-profile-photo-img {
|
||||
.um-modal.no-photo .um-modal-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.ajax-upload-dragdrop span.icon,
|
||||
.ajax-upload-dragdrop span.str {
|
||||
display: none;
|
||||
@@ -645,12 +645,10 @@ div.uimob960 .um-profile-photo a.um-profile-photo-img {
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
|
||||
.um-popup {
|
||||
width: 96%;
|
||||
margin-left: 2%;
|
||||
left: 0;
|
||||
top: 15px;
|
||||
width: 96% !important;
|
||||
margin-left: 2% !important;
|
||||
left: 0 !important;
|
||||
top: 15px !important;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1148,3 +1148,14 @@ small.um-max-filesize span{
|
||||
float: none;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.um-textarea-html-value {
|
||||
border: none;
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: auto;
|
||||
max-height: none;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
||||
"use strict";var um_components=wp.components,umSelectControl=um_components.SelectControl,umTextareaControl=um_components.TextareaControl;function um_admin_blocks_custom_fields(e,t){return wp.hooks.applyFilters("um_admin_blocks_custom_fields",[],e,t)}var um_block_restriction=wp.compose.createHigherOrderComponent(function(s){var _={um_who_access:"um_block_settings_hide",um_roles_access:"um_block_settings_hide",um_message_type:"um_block_settings_hide",um_message_content:"um_block_settings_hide"},_=wp.hooks.applyFilters("um_admin_blocks_condition_fields_default",_);return function(t){var e=void 0!==t.attributes.um_is_restrict&&t.attributes.um_is_restrict;return!0!==t.attributes.um_is_restrict?(_.um_who_access="um_block_settings_hide",_.um_roles_access="um_block_settings_hide",_.um_message_type="um_block_settings_hide",_.um_message_content="um_block_settings_hide"):(_.um_who_access="",0===parseInt(t.attributes.um_who_access)||void 0===t.attributes.um_who_access?(_.um_roles_access="um_block_settings_hide",_.um_message_type="um_block_settings_hide",_.um_message_content="um_block_settings_hide"):(1===parseInt(t.attributes.um_who_access)&&(_.um_roles_access=""),_.um_message_type="",2===parseInt(t.attributes.um_message_type)?_.um_message_content="":_.um_message_content="um_block_settings_hide")),_=wp.hooks.applyFilters("um_admin_blocks_condition_fields",_,t),wp.element.createElement(wp.element.Fragment,{},wp.element.createElement(s,t),wp.element.createElement(wp.blockEditor.InspectorControls,{},wp.element.createElement(wp.components.PanelBody,{title:wp.i18n.__("Ultimate Member: Content Restriction","ultimate-member"),className:"um_block_settings"},wp.element.createElement(wp.components.ToggleControl,{label:wp.i18n.__("Restrict access?","ultimate-member"),checked:e,onChange:function(e){t.setAttributes({um_is_restrict:e}),!1===e?(_.um_who_access="um_block_settings_hide",_.um_roles_access="um_block_settings_hide",_.um_message_type="um_block_settings_hide",_.um_message_content="um_block_settings_hide"):_.um_who_access="",_=wp.hooks.applyFilters("um_admin_blocks_condition_fields_on_change",_,"um_is_restrict",e)}}),wp.element.createElement(umSelectControl,{type:"number",className:_.um_who_access,label:wp.i18n.__("Who can access this block?","ultimate-member"),value:t.attributes.um_who_access,options:[{label:wp.i18n.__("Everyone","ultimate-member"),value:0},{label:wp.i18n.__("Logged in users","ultimate-member"),value:1},{label:wp.i18n.__("Logged out users","ultimate-member"),value:2}],onChange:function(e){t.setAttributes({um_who_access:e}),0===parseInt(e)?(_.um_message_type="um_block_settings_hide",_.um_message_content="um_block_settings_hide",_.um_roles_access="um_block_settings_hide"):1===parseInt(e)?(_.um_message_type="",_.um_roles_access=""):(_.um_message_type="",_.um_roles_access="um_block_settings_hide"),_=wp.hooks.applyFilters("um_admin_blocks_condition_fields_on_change",_,"um_who_access",e)}}),wp.element.createElement(umSelectControl,{multiple:!0,className:_.um_roles_access,label:wp.i18n.__("What roles can access this block?","ultimate-member"),value:t.attributes.um_roles_access,options:um_restrict_roles,onChange:function(e){t.setAttributes({um_roles_access:e})}}),wp.element.createElement(umSelectControl,{type:"number",className:_.um_message_type,label:wp.i18n.__("Restriction action","ultimate-member"),value:t.attributes.um_message_type,options:[{label:wp.i18n.__("Hide block","ultimate-member"),value:0},{label:wp.i18n.__("Show global default message","ultimate-member"),value:1},{label:wp.i18n.__("Show custom message","ultimate-member"),value:2}],onChange:function(e){t.setAttributes({um_message_type:e}),2===parseInt(e)?_.um_message_content="":_.um_message_content="um_block_settings_hide"}}),wp.element.createElement(umTextareaControl,{type:"number",className:_.um_message_content,label:wp.i18n.__("Custom restricted access message","ultimate-member"),value:t.attributes.um_message_content,onChange:function(e){t.setAttributes({um_message_content:e})}}),um_admin_blocks_custom_fields(_,t))))}},"um_block_restriction");wp.hooks.addFilter("editor.BlockEdit","um-block/um_block_restriction",um_block_restriction);
|
||||
var um_components=wp.components,umSelectControl=um_components.SelectControl,umTextareaControl=um_components.TextareaControl;function um_admin_blocks_custom_fields(e,t){return wp.hooks.applyFilters("um_admin_blocks_custom_fields",[],e,t)}var um_block_restriction=wp.compose.createHigherOrderComponent(function(s){var _={um_who_access:"um_block_settings_hide",um_roles_access:"um_block_settings_hide",um_message_type:"um_block_settings_hide",um_message_content:"um_block_settings_hide"},_=wp.hooks.applyFilters("um_admin_blocks_condition_fields_default",_);return function(t){var e=void 0!==t.attributes.um_is_restrict&&t.attributes.um_is_restrict;return!0!==t.attributes.um_is_restrict?(_.um_who_access="um_block_settings_hide",_.um_roles_access="um_block_settings_hide",_.um_message_type="um_block_settings_hide",_.um_message_content="um_block_settings_hide"):(_.um_who_access="",0===parseInt(t.attributes.um_who_access)||void 0===t.attributes.um_who_access?(_.um_roles_access="um_block_settings_hide",_.um_message_type="um_block_settings_hide",_.um_message_content="um_block_settings_hide"):(1===parseInt(t.attributes.um_who_access)&&(_.um_roles_access=""),_.um_message_type="",2===parseInt(t.attributes.um_message_type)?_.um_message_content="":_.um_message_content="um_block_settings_hide")),_=wp.hooks.applyFilters("um_admin_blocks_condition_fields",_,t),wp.element.createElement(wp.element.Fragment,{},wp.element.createElement(s,t),wp.element.createElement(wp.blockEditor.InspectorControls,{},wp.element.createElement(wp.components.PanelBody,{title:wp.i18n.__("Ultimate Member: Content Restriction","ultimate-member"),className:"um_block_settings"},wp.element.createElement(wp.components.ToggleControl,{label:wp.i18n.__("Restrict access?","ultimate-member"),checked:e,onChange:function(e){t.setAttributes({um_is_restrict:e}),!1===e?(_.um_who_access="um_block_settings_hide",_.um_roles_access="um_block_settings_hide",_.um_message_type="um_block_settings_hide",_.um_message_content="um_block_settings_hide"):_.um_who_access="",_=wp.hooks.applyFilters("um_admin_blocks_condition_fields_on_change",_,"um_is_restrict",e)}}),wp.element.createElement(umSelectControl,{type:"number",className:_.um_who_access,label:wp.i18n.__("Who can access this block?","ultimate-member"),value:t.attributes.um_who_access,options:[{label:wp.i18n.__("Everyone","ultimate-member"),value:0},{label:wp.i18n.__("Logged in users","ultimate-member"),value:1},{label:wp.i18n.__("Logged out users","ultimate-member"),value:2}],onChange:function(e){t.setAttributes({um_who_access:e}),0===parseInt(e)?(_.um_message_type="um_block_settings_hide",_.um_message_content="um_block_settings_hide",_.um_roles_access="um_block_settings_hide"):1===parseInt(e)?(_.um_message_type="",_.um_roles_access=""):(_.um_message_type="",_.um_roles_access="um_block_settings_hide"),_=wp.hooks.applyFilters("um_admin_blocks_condition_fields_on_change",_,"um_who_access",e)}}),wp.element.createElement(umSelectControl,{multiple:!0,className:_.um_roles_access,label:wp.i18n.__("What roles can access this block?","ultimate-member"),value:t.attributes.um_roles_access,options:um_restrict_roles,onChange:function(e){t.setAttributes({um_roles_access:e})}}),wp.element.createElement(umSelectControl,{type:"number",className:_.um_message_type,label:wp.i18n.__("Restriction action","ultimate-member"),value:t.attributes.um_message_type,options:[{label:wp.i18n.__("Hide block","ultimate-member"),value:0},{label:wp.i18n.__("Show global default message","ultimate-member"),value:1},{label:wp.i18n.__("Show custom message","ultimate-member"),value:2}],onChange:function(e){t.setAttributes({um_message_type:e}),2===parseInt(e)?_.um_message_content="":_.um_message_content="um_block_settings_hide"}}),wp.element.createElement(umTextareaControl,{type:"number",className:_.um_message_content,label:wp.i18n.__("Custom restricted access message","ultimate-member"),value:t.attributes.um_message_content,onChange:function(e){t.setAttributes({um_message_content:e})}}),um_admin_blocks_custom_fields(_,t))))}},"um_block_restriction");wp.hooks.addFilter("editor.BlockEdit","um-block/um_block_restriction",um_block_restriction);
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
jQuery(document).ready(function(){const n=jQuery(".um-secure-scan-results"),t=jQuery(".um-secure-scan-content"),e=jQuery("input[data-field_id^='banned_capabilities']");var c={init:function(){n.css({"margin-top":"10px",padding:"10px","padding-bottom":"10px","background-color":"#fff",display:"block","max-height":"200px",height:"500px","overflow-y":"scroll"}),t.on("click",function(e){c.effect(),e.preventDefault(),jQuery(this).prop("disabled",!0),n.empty(),c.log(wp.i18n.__("Scanning site..","ultimate-member")),c.ajax("")}),e.on("change",function(){t.after(' <small style="color: red;">'+wp.i18n.__("You can start the scan now but you must save the settings to apply the selected capabilities after the scan is complete.","ultimate-member")+"</small>"),e.off("change")})},ajax:function(e){let a=[];n.parents(".um-form-table").find('input[type="checkbox"][data-field_id^="banned_capabilities_"]:checked').each(function(){a.push(jQuery(this).data("field_id").replace("banned_capabilities_",""))});e={nonce:um_admin_scripts.nonce,capabilities:a,last_scanned_capability:e};wp.ajax.send("um_secure_scan_affected_users",{data:e,success:function(e){e.completed?e.completed&&(n.empty(),c.log(e.recommendations),n.find(".current").removeClass("current"),t.prop("disabled",!1)):(c.ajax(e.last_scanned_capability),c.log(e.message))}})},log:function(e){n.find(".current").removeClass("current"),n.append('<span class="current">'+e+"</span><br/>")},effect:function(){setInterval(function(){n.find(".current").fadeTo(100,.1).fadeTo(200,1)},1e3)}};c.init()});
|
||||
jQuery(document).ready(function(){let t=jQuery(".um-secure-scan-results"),n=jQuery(".um-secure-scan-content"),e=jQuery("input[data-field_id^='banned_capabilities']");var c={init:function(){t.css({"margin-top":"10px",padding:"10px","padding-bottom":"10px","background-color":"#fff",display:"block","max-height":"200px",height:"500px","overflow-y":"scroll"}),n.on("click",function(e){c.effect(),e.preventDefault(),jQuery(this).prop("disabled",!0),t.empty(),c.log(wp.i18n.__("Scanning site..","ultimate-member")),c.ajax("")}),e.on("change",function(){n.after(' <small style="color: red;">'+wp.i18n.__("You can start the scan now but you must save the settings to apply the selected capabilities after the scan is complete.","ultimate-member")+"</small>"),e.off("change")})},ajax:function(e){let a=[];t.parents(".um-form-table").find('input[type="checkbox"][data-field_id^="banned_capabilities_"]:checked').each(function(){a.push(jQuery(this).data("field_id").replace("banned_capabilities_",""))});e={nonce:um_admin_scripts.nonce,capabilities:a,last_scanned_capability:e};wp.ajax.send("um_secure_scan_affected_users",{data:e,success:function(e){e.completed?e.completed&&(t.empty(),c.log(e.recommendations),t.find(".current").removeClass("current"),n.prop("disabled",!1)):(c.ajax(e.last_scanned_capability),c.log(e.message))}})},log:function(e){t.find(".current").removeClass("current"),t.append('<span class="current">'+e+"</span><br/>")},effect:function(){setInterval(function(){t.find(".current").fadeTo(100,.1).fadeTo(200,1)},1e3)}};c.init()});
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){"use strict";jQuery(document).on("click","a.um-toggle-gdpr",function(e){var e=jQuery(e.currentTarget),t=e.closest(".um-field-area"),g=t.find(".um-gdpr-content");g.is(":visible")?(t.find("a.um-toggle-gdpr").text(e.data("toggle-show")),g.hide().find("a.um-toggle-gdpr").remove(),e.length&&e.get(0).scrollIntoView()):(t.find("a.um-toggle-gdpr").text(e.data("toggle-hide")),g.show().prepend(e.clone()))})}();
|
||||
jQuery(document).on("click","a.um-toggle-gdpr",function(e){var e=jQuery(e.currentTarget),t=e.closest(".um-field-area"),g=t.find(".um-gdpr-content");g.is(":visible")?(t.find("a.um-toggle-gdpr").text(e.data("toggle-show")),g.hide().find("a.um-toggle-gdpr").remove(),e.length&&e.get(0).scrollIntoView()):(t.find("a.um-toggle-gdpr").text(e.data("toggle-hide")),g.show().prepend(e.clone()))});
|
||||
@@ -1534,7 +1534,9 @@ jQuery(document.body).ready( function() {
|
||||
});
|
||||
|
||||
if ( directory.find( '.um-search-filter select[data-um-parent="' + filter_name + '"]' ).length > 0 ) {
|
||||
select.trigger('change');
|
||||
setTimeout(function(){
|
||||
select.trigger('change');
|
||||
}, 250);
|
||||
}
|
||||
|
||||
} else if ( type === 'slider' ) {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -417,7 +417,7 @@ jQuery(document).ready(function() {
|
||||
e.preventDefault();
|
||||
var hook = jQuery(this).data('hook');
|
||||
var user_id = jQuery(this).data('user_id');
|
||||
var arguments = jQuery(this).data('arguments');
|
||||
var args = jQuery(this).data('args');
|
||||
|
||||
if ( jQuery(this).data('js-remove') ){
|
||||
jQuery(this).parents('.'+jQuery(this).data('js-remove')).fadeOut('fast');
|
||||
@@ -430,7 +430,7 @@ jQuery(document).ready(function() {
|
||||
action: 'um_muted_action',
|
||||
hook: hook,
|
||||
user_id: user_id,
|
||||
arguments: arguments,
|
||||
arguments: args,
|
||||
nonce: um_scripts.nonce
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,5 +1,62 @@
|
||||
== Changelog ==
|
||||
|
||||
= 2.8.7 September 30, 2024 =
|
||||
|
||||
* Enhancements:
|
||||
|
||||
- Added: Single user actions on WP Users list table
|
||||
- Updated: User status filter on WP Users list table
|
||||
- Updated: User bulk actions on WP Users list table
|
||||
- Updated: User actions on User Profile and Member Directory card
|
||||
- Added: Applying shortcodes in the post restriction message
|
||||
- Added: ProfilePage Structured Data
|
||||
- Added: Ability to use HTML tags (allowed in `wp_kses_post`) in the global block restriction message
|
||||
- Changed: Some wp-admin fields descriptions
|
||||
- Updated: Data format in `um_admin_bulk_user_actions_hook` hook. Changed format from `$action_slug => array( 'label' => $action_title )` to `$action_slug => $action_title`
|
||||
- Added: `$old_status` param to `um_after_user_status_is_changed` hook
|
||||
- Added: `$user_id` param to `um_before_user_hash_is_changed` hook
|
||||
- Added: `$user_id, $hash, $expiration` params to `um_after_user_hash_is_changed` hook
|
||||
- Added: `um_restricted_post_content` hook
|
||||
- Added: `um_loggedin_inner_content` hook
|
||||
- Added: `um_profile_dynamic_meta_profile_schema` hook
|
||||
|
||||
* Bugfixes:
|
||||
|
||||
- Fixed: Single user action on User Profile security vulnerability. CVE ID: CVE-2024-8520
|
||||
- Fixed: [um_loggedin] shortcode security vulnerability. CVE ID: CVE-2024-8519
|
||||
- Fixed: Performance issue related to Settings > Secure tab
|
||||
- Fixed: The "Clear All" button in the member directory did not reset all dependent dropdowns
|
||||
- Fixed: Telegram and Discord social links in profile header
|
||||
- Fixed: UM links to empty phone numbers
|
||||
- Fixed: Email changing via User Account flush session. Security enhancement because email can be used for login
|
||||
- Fixed: User Profile image URL in meta tags
|
||||
- Fixed: Empty User Profile and PHP Fatal error when cannot get profile field data
|
||||
- Fixed: Parsing /modal/ templates and parsing templates on the Windows hosting
|
||||
- Fixed: Validation `form_id` attribute in the `ultimatemember` shortcode
|
||||
|
||||
* Templates required update:
|
||||
|
||||
- login-to-view.php
|
||||
|
||||
* Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade
|
||||
|
||||
* Deprecated:
|
||||
|
||||
- Hook: `um_after_user_status_is_changed_hook`. Use action hook `um_after_user_status_is_changed` instead.
|
||||
- Hook: `um_when_status_is_set`. Use action hook `um_before_user_status_is_set` instead.
|
||||
- Hook: `um_admin_user_action_hook`. Use filter hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
- Hook: `um_admin_user_action_{$bulk_action}_hook`. Use filter hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
- Hook: `um_admin_custom_hook_{$action}`. Use filter hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
- Function: `UM()->user()->set_status( $status )`. Use function `UM()->common()->users()->set_status( $status, $user_id )` instead.
|
||||
- Function: `UM()->user()->assign_secretkey()`. Use function `UM()->common()->users()->assign_secretkey( $user_id )` instead.
|
||||
- Function: `UM()->user()->approve( $repeat )`. Use function `UM()->common()->users()->approve( $user_id, $force )` instead.
|
||||
- Function: `UM()->user()->email_pending()`. Use function `UM()->common()->users()->approve( $user_id, $force )` instead.
|
||||
- Function: `UM()->user()->pending()`. Use function `UM()->common()->users()->set_as_pending( $user_id, $force )` instead.
|
||||
- Function: `UM()->user()->reject()`. Use function `UM()->common()->users()->reject( $user_id, $force )` instead.
|
||||
- Function: `UM()->user()->deactivate()`. Use function `UM()->common()->users()->deactivate( $user_id, $force )` instead.
|
||||
- Function: `UM()->user()->user_exists_by_id( $user_id )`. Use function `UM()->common()->users()::user_exists( $user_id )` instead.
|
||||
- Function: `UM()->files()->format_bytes( $size )`. Use function `UM()->common()->filesystem()::format_bytes( $size )` instead.
|
||||
|
||||
= 2.8.6 May 22, 2024 =
|
||||
|
||||
* Enhancements:
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
namespace um\admin;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\admin\Actions_Listener' ) ) {
|
||||
|
||||
/**
|
||||
* Class Actions_Listener
|
||||
*
|
||||
* @package um\admin
|
||||
*/
|
||||
class Actions_Listener {
|
||||
|
||||
/**
|
||||
* Actions_Listener constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_init', array( $this, 'actions_listener' ) );
|
||||
add_filter( 'um_adm_action_individual_nonce_actions', array( $this, 'extends_individual_nonce_actions' ) ); // @todo remove soon after UM core update
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle wp-admin actions
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public function actions_listener() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['um_adm_action'] ) ) {
|
||||
switch ( sanitize_key( $_REQUEST['um_adm_action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification -- there is nonce verification below for each case
|
||||
case 'approve_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "approve_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->approve( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_approved',
|
||||
'approved_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'reactivate_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "reactivate_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->reactivate( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_reactivated',
|
||||
'reactivated_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'put_user_as_pending':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "put_user_as_pending{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->set_as_pending( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_pending',
|
||||
'pending_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'resend_user_activation':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "resend_user_activation{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->send_activation( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_resend_activation',
|
||||
'resend_activation_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'reject_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "reject_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->reject( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_rejected',
|
||||
'rejected_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'deactivate_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "deactivate_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->deactivate( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_deactivate',
|
||||
'deactivated_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function extends_individual_nonce_actions( $actions ) {
|
||||
$actions[] = 'approve_user';
|
||||
$actions[] = 'reactivate_user';
|
||||
$actions[] = 'put_user_as_pending';
|
||||
$actions[] = 'resend_user_activation';
|
||||
$actions[] = 'reject_user';
|
||||
$actions[] = 'deactivate_user';
|
||||
return $actions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
|
||||
add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) );
|
||||
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
|
||||
add_action( 'um_admin_do_action__user_action', array( &$this, 'user_action' ) );
|
||||
add_action( 'um_admin_do_action__check_templates_version', array( &$this, 'check_templates_version' ) );
|
||||
|
||||
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
|
||||
@@ -79,10 +78,12 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
}
|
||||
|
||||
public function includes() {
|
||||
$this->actions_listener();
|
||||
$this->enqueue();
|
||||
$this->notices();
|
||||
$this->secure();
|
||||
$this->site_health();
|
||||
$this->users_columns();
|
||||
}
|
||||
|
||||
public function init_variables() {
|
||||
@@ -1759,6 +1760,8 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
delete_transient( "um_count_users_{$status}" );
|
||||
}
|
||||
|
||||
delete_transient( 'um_count_users_all' );
|
||||
|
||||
do_action( 'um_flush_user_status_cache' );
|
||||
|
||||
$url = add_query_arg(
|
||||
@@ -1840,69 +1843,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Various user actions.
|
||||
*/
|
||||
public function user_action() {
|
||||
if ( ! current_user_can( 'edit_users' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ! isset( $_REQUEST['sub'] ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ! isset( $_REQUEST['user_id'] ) ) {
|
||||
die();
|
||||
}
|
||||
|
||||
um_fetch_user( absint( $_REQUEST['user_id'] ) );
|
||||
|
||||
$subaction = sanitize_key( $_REQUEST['sub'] );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_admin_user_action_hook
|
||||
* @description Action on bulk user subaction
|
||||
* @input_vars
|
||||
* [{"var":"$subaction","type":"string","desc":"Bulk Subaction"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_admin_user_action_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_admin_user_action_hook', 'my_admin_user_action', 10, 1 );
|
||||
* function my_admin_user_action( $subaction ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_admin_user_action_hook', $subaction );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_admin_user_action_{$subaction}_hook
|
||||
* @description Action on bulk user subaction
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_admin_user_action_{$subaction}_hook', 'function_name', 10 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_admin_user_action_{$subaction}_hook', 'my_admin_user_action', 10 );
|
||||
* function my_admin_user_action() {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_admin_user_action_{$subaction}_hook" );
|
||||
|
||||
um_reset_user();
|
||||
|
||||
wp_safe_redirect( add_query_arg( 'update', 'um_user_updated', admin_url( '?page=ultimatemember' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manual check templates versions.
|
||||
*/
|
||||
@@ -1946,7 +1886,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
$action = sanitize_key( $_REQUEST['um_adm_action'] );
|
||||
|
||||
$individual_nonce_actions = array(
|
||||
'user_action',
|
||||
'duplicate_form',
|
||||
);
|
||||
$individual_nonce_actions = apply_filters( 'um_adm_action_individual_nonce_actions', $individual_nonce_actions );
|
||||
@@ -2071,6 +2010,18 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
return $parent_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @return Actions_Listener
|
||||
*/
|
||||
public function actions_listener() {
|
||||
if ( empty( UM()->classes['um\admin\actions_listener'] ) ) {
|
||||
UM()->classes['um\admin\actions_listener'] = new Actions_Listener();
|
||||
}
|
||||
return UM()->classes['um\admin\actions_listener'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.7.0
|
||||
*
|
||||
@@ -2130,5 +2081,17 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
}
|
||||
return UM()->classes['um\admin\site_health'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @return Users_Columns
|
||||
*/
|
||||
public function users_columns() {
|
||||
if ( empty( UM()->classes['um\admin\users_columns'] ) ) {
|
||||
UM()->classes['um\admin\users_columns'] = new Users_Columns();
|
||||
}
|
||||
return UM()->classes['um\admin\users_columns'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,8 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
|
||||
}
|
||||
// Restore Account Status.
|
||||
if ( isset( $metadata['account_status'] ) ) {
|
||||
UM()->user()->set_status( $metadata['account_status'] );
|
||||
// UM()->user()->set_status( $metadata['account_status'] );
|
||||
UM()->common()->users()->set_status( $user_id, $metadata['account_status'] );
|
||||
}
|
||||
|
||||
// Delete blocked meta.
|
||||
@@ -182,7 +183,6 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
|
||||
*/
|
||||
public function add_settings( $settings ) {
|
||||
$nonce = wp_create_nonce( 'um-secure-expire-session-nonce' );
|
||||
$count_users = count_users();
|
||||
|
||||
$banned_capabilities = array();
|
||||
$banned_admin_capabilities = UM()->common()->secure()->get_banned_capabilities_list();
|
||||
@@ -245,7 +245,10 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
|
||||
),
|
||||
);
|
||||
|
||||
$count_users_exclude_me = $count_users['total_users'] - 1;
|
||||
global $wpdb;
|
||||
$count_users = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->users}" );
|
||||
|
||||
$count_users_exclude_me = $count_users - 1;
|
||||
if ( $count_users_exclude_me > 0 ) {
|
||||
$secure_fields[] = array(
|
||||
'id' => 'force_reset_passwords',
|
||||
|
||||
@@ -0,0 +1,633 @@
|
||||
<?php
|
||||
namespace um\admin;
|
||||
|
||||
use WP_User;
|
||||
use WP_User_Query;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\admin\Users_Columns' ) ) {
|
||||
|
||||
/**
|
||||
* Class Users_Columns
|
||||
*
|
||||
* @package um\admin
|
||||
*/
|
||||
class Users_Columns {
|
||||
|
||||
/**
|
||||
* Users_Columns constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_filter( 'manage_users_columns', array( &$this, 'manage_users_columns' ) );
|
||||
add_filter( 'manage_users_custom_column', array( &$this, 'manage_users_custom_column' ), 10, 3 );
|
||||
|
||||
add_action( 'pre_user_query', array( &$this, 'sort_by_newest' ) );
|
||||
add_filter( 'users_list_table_query_args', array( &$this, 'hide_by_caps' ), 1 );
|
||||
add_filter( 'views_users', array( &$this, 'restrict_role_links' ) );
|
||||
|
||||
add_filter( 'user_row_actions', array( &$this, 'user_row_actions' ), 10, 2 );
|
||||
add_filter( 'bulk_actions-users', array( &$this, 'add_bulk_actions' ) );
|
||||
add_filter( 'handle_bulk_actions-users', array( &$this, 'handle_bulk_actions' ), 10, 3 );
|
||||
|
||||
add_action( 'manage_users_extra_tablenav', array( &$this, 'add_status_filter' ) );
|
||||
add_action( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
|
||||
|
||||
add_filter( 'removable_query_args', array( &$this, 'add_removable_query_args' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter: Add column 'Status'
|
||||
*
|
||||
* @param array $columns
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function manage_users_columns( $columns ) {
|
||||
$columns['um_account_status'] = __( 'Status', 'ultimate-member' );
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter: Show column 'Status'
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $column_name
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function manage_users_custom_column( $value, $column_name, $user_id ) {
|
||||
if ( 'um_account_status' !== $column_name ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$status = UM()->common()->users()->get_status( $user_id, 'formatted' );
|
||||
|
||||
$status = apply_filters( 'um_users_column_account_status', $status, $user_id );
|
||||
|
||||
$value = '<span class="um-user-status">' . esc_html( $status ) . '</span>';
|
||||
|
||||
if ( get_current_user_id() === $user_id ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$row_actions = array();
|
||||
if ( UM()->common()->users()->can_be_approved( $user_id ) ) {
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um_adm_action' => 'approve_user',
|
||||
'uid' => $user_id,
|
||||
'_wpnonce' => wp_create_nonce( 'approve_user' . $user_id ),
|
||||
),
|
||||
admin_url( 'users.php' )
|
||||
);
|
||||
$row_actions[] = '<a href="' . esc_url( $url ) . '" class="um-set-status-approved">' . esc_html__( 'Approve', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
if ( UM()->common()->users()->can_be_reactivated( $user_id ) ) {
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um_adm_action' => 'reactivate_user',
|
||||
'uid' => $user_id,
|
||||
'_wpnonce' => wp_create_nonce( 'reactivate_user' . $user_id ),
|
||||
),
|
||||
admin_url( 'users.php' )
|
||||
);
|
||||
$row_actions[] = '<a href="' . esc_url( $url ) . '" class="um-reactivate-user">' . esc_html__( 'Reactivate', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
if ( UM()->common()->users()->can_be_set_as_pending( $user_id ) ) {
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um_adm_action' => 'put_user_as_pending',
|
||||
'uid' => $user_id,
|
||||
'_wpnonce' => wp_create_nonce( 'put_user_as_pending' . $user_id ),
|
||||
),
|
||||
admin_url( 'users.php' )
|
||||
);
|
||||
$row_actions[] = '<a href="' . esc_url( $url ) . '" class="um-set-status-pending">' . esc_html__( 'Put as pending', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
if ( UM()->common()->users()->can_activation_send( $user_id ) ) {
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um_adm_action' => 'resend_user_activation',
|
||||
'uid' => $user_id,
|
||||
'_wpnonce' => wp_create_nonce( 'resend_user_activation' . $user_id ),
|
||||
),
|
||||
admin_url( 'users.php' )
|
||||
);
|
||||
$row_actions[] = '<a href="' . esc_url( $url ) . '" class="um-resend-activation-email">' . esc_html__( 'Resend activation email', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
if ( UM()->common()->users()->can_be_rejected( $user_id ) ) {
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um_adm_action' => 'reject_user',
|
||||
'uid' => $user_id,
|
||||
'_wpnonce' => wp_create_nonce( 'reject_user' . $user_id ),
|
||||
),
|
||||
admin_url( 'users.php' )
|
||||
);
|
||||
$row_actions[] = '<a href="' . esc_url( $url ) . '" class="um-set-status-rejected" onclick="return confirm( \'' . esc_js( __( 'Are you sure you want to reject this user membership?', 'ultimate-member' ) ) . '\' );">' . esc_html__( 'Reject', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
if ( UM()->common()->users()->can_be_deactivated( $user_id ) ) {
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um_adm_action' => 'deactivate_user',
|
||||
'uid' => $user_id,
|
||||
'_wpnonce' => wp_create_nonce( 'deactivate_user' . $user_id ),
|
||||
),
|
||||
admin_url( 'users.php' )
|
||||
);
|
||||
$row_actions[] = '<a href="' . esc_url( $url ) . '" class="um-deactivate-user" onclick="return confirm( \'' . esc_js( __( 'Are you sure you want to deactivate this user?', 'ultimate-member' ) ) . '\' );">' . esc_html__( 'Deactivate', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
|
||||
$row_actions = apply_filters( 'um_users_column_account_status_row_actions', $row_actions, $user_id );
|
||||
if ( ! empty( $row_actions ) ) {
|
||||
$value .= '<div class="row-actions"><ul class="um-user-status-row-actions"><li>' . implode( '</li><li> | </li><li>', $row_actions ) . '</li></ul></div>';
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change default sorting at WP Users list table
|
||||
*
|
||||
* @param WP_User_Query $query Current instance of WP_User_Query (passed by reference).
|
||||
*/
|
||||
public function sort_by_newest( $query ) {
|
||||
global $pagenow;
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification -- situated in WP native query and just checking sorting
|
||||
if ( 'users.php' === $pagenow && ! isset( $_REQUEST['orderby'] ) && is_admin() ) {
|
||||
$query->query_vars['order'] = 'desc';
|
||||
$query->query_orderby = ' ORDER BY user_registered DESC';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide users who are hidden by role access for not Administrator user
|
||||
*
|
||||
* @param array $args Arguments passed to WP_User_Query to retrieve items for the current
|
||||
* users list table
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function hide_by_caps( $args ) {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
return $args;
|
||||
}
|
||||
|
||||
// @todo avoid um_user() function using
|
||||
// @todo check another restrictions not only the role settings. We need to exclude users per user ID.
|
||||
$can_view_roles = um_user( 'can_view_roles' );
|
||||
if ( ! empty( $can_view_roles ) && um_user( 'can_view_all' ) ) {
|
||||
$args['role__in'] = $can_view_roles;
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide role filters with not accessible roles
|
||||
*
|
||||
* @param array $views
|
||||
* @return array
|
||||
*/
|
||||
public function restrict_role_links( $views ) {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
return $views;
|
||||
}
|
||||
|
||||
$can_view_roles = um_user( 'can_view_roles' );
|
||||
if ( ! empty( $can_view_roles ) && um_user( 'can_view_all' ) ) {
|
||||
$wp_roles = wp_roles();
|
||||
foreach ( $wp_roles->get_names() as $this_role => $name ) {
|
||||
if ( ! in_array( $this_role, $can_view_roles, true ) ) {
|
||||
unset( $views[ $this_role ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom row actions for users page
|
||||
*
|
||||
* @param array $actions
|
||||
* @param WP_User $user_object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function user_row_actions( $actions, $user_object ) {
|
||||
$user_id = $user_object->ID;
|
||||
|
||||
// Link to Ultimate Member Profile.
|
||||
$actions['frontend_profile'] = '<a href="' . esc_url( um_user_profile_url( $user_id ) ) . '">' . esc_html__( 'View profile', 'ultimate-member' ) . '</a>';
|
||||
|
||||
// The link for open popup with the registration data submitted through Ultimate Member Registration form.
|
||||
$submitted = get_user_meta( $user_id, 'submitted', true );
|
||||
if ( ! empty( $submitted ) ) {
|
||||
$actions['view_info'] = '<a href="#" data-modal="UM_preview_registration" data-modal-size="smaller"
|
||||
data-dynamic-content="um_admin_review_registration" data-arg1="' . esc_attr( $user_id ) . '" data-arg2="edit_registration">' . esc_html__( 'Info', 'ultimate-member' ) . '</a>';
|
||||
// For new modal below.
|
||||
// $actions['view_info'] = '<a href="#" class="um-preview-registration" data-user_id="' . esc_attr( $user_id ) . '">' . esc_html__( 'Info', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
|
||||
// Remove row actions for now Administrator role and who cannot view profiles of row's user.
|
||||
if ( ! current_user_can( 'manage_options' ) && ! um_can_view_profile( $user_id ) ) {
|
||||
unset( $actions['frontend_profile'], $actions['view_info'], $actions['view'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the rows actions for the user in wp-admin > Users List Table screen.
|
||||
*
|
||||
* Note: Row actions format is 'key' => 'action_link_html'
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_admin_user_row_actions
|
||||
*
|
||||
* @param {array} $actions User's row actions.
|
||||
* @param {int} $user_id Row's user ID.
|
||||
*
|
||||
* @return {array} User's row actions.
|
||||
*/
|
||||
return apply_filters( 'um_admin_user_row_actions', $actions, $user_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list with the bulk actions.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function get_user_bulk_actions() {
|
||||
$um_actions = array(
|
||||
'um_approve_membership' => __( 'Approve Membership', 'ultimate-member' ),
|
||||
'um_reject_membership' => __( 'Reject Membership', 'ultimate-member' ),
|
||||
'um_put_as_pending' => __( 'Put as Pending Review', 'ultimate-member' ),
|
||||
'um_resend_activation' => __( 'Resend Activation E-mail', 'ultimate-member' ),
|
||||
'um_deactivate' => __( 'Deactivate', 'ultimate-member' ),
|
||||
'um_reactivate' => __( 'Reactivate', 'ultimate-member' ), // um_reenable
|
||||
);
|
||||
/**
|
||||
* Filters wp-admin > Users List Table bulk actions.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @since 2.8.7 changed format from `$action_slug => array( 'label' => $action_title )` to `$action_slug => $action_title`
|
||||
* @hook um_admin_bulk_user_actions_hook
|
||||
*
|
||||
* @param {array} $um_actions Users admin actions.
|
||||
*
|
||||
* @return {array} Users admin actions.
|
||||
*
|
||||
* @example <caption>Add `$action_title` to Users List Table bulk actions.</caption>
|
||||
* function um_custom_admin_bulk_user_actions_hook( $um_actions ) {
|
||||
* $um_actions[ $action_slug ] = $action_title;
|
||||
* return $um_actions;
|
||||
* }
|
||||
* add_filter( 'um_admin_bulk_user_actions_hook', 'um_custom_admin_bulk_user_actions_hook' );
|
||||
*/
|
||||
return apply_filters( 'um_admin_bulk_user_actions_hook', $um_actions );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $actions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_bulk_actions( $actions ) {
|
||||
$rolename = UM()->roles()->get_priority_user_role( get_current_user_id() );
|
||||
$role = get_role( $rolename );
|
||||
|
||||
if ( null === $role ) {
|
||||
return $actions;
|
||||
}
|
||||
|
||||
// Add Ultimate Member bulk actions only when the current user has 'edit_users' capability.
|
||||
if ( ! current_user_can( 'edit_users' ) && ! $role->has_cap( 'edit_users' ) ) {
|
||||
return $actions;
|
||||
}
|
||||
|
||||
$actions[ esc_html__( 'Ultimate Member', 'ultimate-member' ) ] = $this->get_user_bulk_actions();
|
||||
return $actions;
|
||||
}
|
||||
|
||||
private function get_statuses_filter_options() {
|
||||
$statuses = UM()->common()->users()->statuses_list();
|
||||
/**
|
||||
* Filters the user statuses added via Ultimate Member plugin.
|
||||
*
|
||||
* Note: Statuses format is 'key' => 'title'
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_user_statuses_admin_filter_options
|
||||
*
|
||||
* @param {array} $statuses User statuses in Ultimate Member environment.
|
||||
*
|
||||
* @return {array} User statuses.
|
||||
*/
|
||||
return apply_filters( 'um_user_statuses_admin_filter_options', $statuses );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds HTML with the filter by the Ultimate Member status.
|
||||
*
|
||||
* @param string $which Where the callback's hook fired.
|
||||
*/
|
||||
public function add_status_filter( $which ) {
|
||||
if ( 'top' !== $which ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set default statuses if not already done.
|
||||
UM()->setup()->set_default_user_status();
|
||||
|
||||
$id = 'um_user_status';
|
||||
|
||||
// need to add there additional nonce field because WordPress native _wpnonce field isn't visible on the users.php screen then custom actions
|
||||
wp_nonce_field( 'um-bulk-users', '_um_wpnonce', false );
|
||||
|
||||
$statuses = $this->get_statuses_filter_options();
|
||||
?>
|
||||
<div class="alignleft actions um-filter-by-status">
|
||||
<label class="screen-reader-text" for="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'All Statuses', 'ultimate-member' ); ?></label>
|
||||
<select name="<?php echo esc_attr( $id ); ?>" id="<?php echo esc_attr( $id ); ?>">
|
||||
<option value=""><?php esc_html_e( 'All Statuses', 'ultimate-member' ); ?></option>
|
||||
<?php
|
||||
foreach ( $statuses as $k => $v ) {
|
||||
$selected = isset( $_GET[ $id ] ) && sanitize_key( $_GET[ $id ] ) === $k; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- native WordPress nonce is used
|
||||
?>
|
||||
<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $selected ); ?>><?php echo esc_html( $v ); ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php submit_button( __( 'Filter', 'ultimate-member' ), '', 'um_filter_users', false ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for handling custom bulk actions on the Users List Table
|
||||
*
|
||||
* @param string $sendback URL for redirect after handling bulk action
|
||||
* @param string $current_action Bulk action key
|
||||
* @param array $userids User IDs
|
||||
*
|
||||
* @return string URL for redirect after handling bulk action
|
||||
*/
|
||||
public function handle_bulk_actions( $sendback, $current_action, $userids ) {
|
||||
$um_actions = $this->get_user_bulk_actions();
|
||||
|
||||
if ( ! array_key_exists( $current_action, $um_actions ) ) {
|
||||
return $sendback;
|
||||
}
|
||||
|
||||
// need to handle there additional nonce field because WordPress native _wpnonce field isn't visible on the users.php screen then custom actions
|
||||
check_admin_referer( 'um-bulk-users', '_um_wpnonce' );
|
||||
|
||||
$rolename = UM()->roles()->get_priority_user_role( get_current_user_id() );
|
||||
$role = get_role( $rolename );
|
||||
|
||||
if ( null === $role ) {
|
||||
return $sendback;
|
||||
}
|
||||
|
||||
// Make Ultimate Member bulk actions only when the current user has 'edit_users' capability.
|
||||
if ( ! current_user_can( 'edit_users' ) && ! $role->has_cap( 'edit_users' ) ) {
|
||||
wp_die( esc_html__( 'You do not have enough permissions to do that.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$users = array_map( 'absint', $userids );
|
||||
$users = array_diff( $users, array( get_current_user_id() ) ); // cannot make any action related to himself.
|
||||
|
||||
switch ( $current_action ) {
|
||||
case 'um_approve_membership':
|
||||
$approved_count = 0;
|
||||
foreach ( $users as $user_id ) {
|
||||
$res = UM()->common()->users()->approve( $user_id );
|
||||
if ( $res ) {
|
||||
++$approved_count;
|
||||
}
|
||||
}
|
||||
|
||||
$sendback = add_query_arg(
|
||||
array(
|
||||
'approved_count' => $approved_count,
|
||||
'update' => 'um_approved',
|
||||
),
|
||||
$this->set_redirect_uri( $sendback )
|
||||
);
|
||||
break;
|
||||
|
||||
case 'um_reactivate':
|
||||
$reactivated_count = 0;
|
||||
foreach ( $users as $user_id ) {
|
||||
$res = UM()->common()->users()->reactivate( $user_id );
|
||||
if ( $res ) {
|
||||
++$reactivated_count;
|
||||
}
|
||||
}
|
||||
|
||||
$sendback = add_query_arg(
|
||||
array(
|
||||
'reactivated_count' => $reactivated_count,
|
||||
'update' => 'um_reactivated',
|
||||
),
|
||||
$this->set_redirect_uri( $sendback )
|
||||
);
|
||||
break;
|
||||
|
||||
case 'um_reject_membership':
|
||||
$rejected_count = 0;
|
||||
foreach ( $users as $user_id ) {
|
||||
$res = UM()->common()->users()->reject( $user_id );
|
||||
if ( $res ) {
|
||||
++$rejected_count;
|
||||
}
|
||||
}
|
||||
|
||||
$sendback = add_query_arg(
|
||||
array(
|
||||
'rejected_count' => $rejected_count,
|
||||
'update' => 'um_rejected',
|
||||
),
|
||||
$this->set_redirect_uri( $sendback )
|
||||
);
|
||||
break;
|
||||
|
||||
case 'um_deactivate':
|
||||
$deactivated_count = 0;
|
||||
foreach ( $users as $user_id ) {
|
||||
$res = UM()->common()->users()->deactivate( $user_id );
|
||||
if ( $res ) {
|
||||
++$deactivated_count;
|
||||
}
|
||||
}
|
||||
|
||||
$sendback = add_query_arg(
|
||||
array(
|
||||
'deactivated_count' => $deactivated_count,
|
||||
'update' => 'um_deactivate',
|
||||
),
|
||||
$this->set_redirect_uri( $sendback )
|
||||
);
|
||||
break;
|
||||
|
||||
case 'um_put_as_pending':
|
||||
$pending_count = 0;
|
||||
foreach ( $users as $user_id ) {
|
||||
$res = UM()->common()->users()->set_as_pending( $user_id );
|
||||
if ( $res ) {
|
||||
++$pending_count;
|
||||
}
|
||||
}
|
||||
|
||||
$sendback = add_query_arg(
|
||||
array(
|
||||
'pending_count' => $pending_count,
|
||||
'update' => 'um_pending',
|
||||
),
|
||||
$this->set_redirect_uri( $sendback )
|
||||
);
|
||||
break;
|
||||
|
||||
case 'um_resend_activation':
|
||||
$email_pending_count = 0;
|
||||
foreach ( $users as $user_id ) {
|
||||
$res = UM()->common()->users()->send_activation( $user_id );
|
||||
if ( $res ) {
|
||||
++$email_pending_count;
|
||||
}
|
||||
}
|
||||
|
||||
$sendback = add_query_arg(
|
||||
array(
|
||||
'resend_activation_count' => $email_pending_count,
|
||||
'update' => 'um_resend_activation',
|
||||
),
|
||||
$this->set_redirect_uri( $sendback )
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
/**
|
||||
* Fires when a custom Ultimate Member bulk action for wp-admin > Users list table should be handled.
|
||||
*
|
||||
* The redirect link should be modified with success or failure feedback
|
||||
* from the action to be used to display feedback to the user.
|
||||
*
|
||||
* The dynamic portion of the hook name, `$current_action`, refers to the current bulk action.
|
||||
* Use together with custom actions added via `um_admin_bulk_user_actions_hook` hook.
|
||||
*
|
||||
* @param {string} $sendback The redirect URL.
|
||||
* @param {array} $userids Selected users in bulk action.
|
||||
*
|
||||
* @return {string} The redirect URL.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_handle_bulk_actions-users-{$current_action}
|
||||
*
|
||||
* @example <caption>Handle custom-action and set redirect after it.</caption>
|
||||
* function um_custom_bulk_actions_users( $sendback, $userids ) {
|
||||
* foreach ( $userids as $user_id ) {
|
||||
* // make some action here
|
||||
* }
|
||||
* return add_query_arg( 'action_counter', 'completed action count', $sendback );
|
||||
* }
|
||||
* add_filter( 'um_handle_bulk_actions-users-custom-action', 'um_custom_bulk_actions_users' );
|
||||
*/
|
||||
$sendback = apply_filters( "um_handle_bulk_actions-users-{$current_action}", $sendback, $userids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||
break;
|
||||
}
|
||||
|
||||
return $sendback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter WP users by UM Status
|
||||
*
|
||||
* WP_User_Query $query Current instance of WP_User_Query (passed by reference).
|
||||
*/
|
||||
public function filter_users_by_status( $query ) {
|
||||
global $wpdb, $pagenow;
|
||||
|
||||
if ( 'users.php' !== $pagenow || ! is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( empty( $_REQUEST['um_user_status'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$status = sanitize_key( $_REQUEST['um_user_status'] );
|
||||
|
||||
/**
|
||||
* Filters the marker to disable Ultimate Member default filter by user status.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_skip_filter_users_by_status
|
||||
*
|
||||
* @param {bool} $skip Marker to skip Ultimate Member core user filter handler.
|
||||
* @param {string} $status User Status
|
||||
*
|
||||
* @return {array} User's row actions.
|
||||
*/
|
||||
$skip_status_filter = apply_filters( 'um_skip_filter_users_by_status', false, $status );
|
||||
if ( false !== $skip_status_filter ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query->query_where = str_replace(
|
||||
'WHERE 1=1',
|
||||
$wpdb->prepare(
|
||||
"WHERE 1=1 AND
|
||||
{$wpdb->users}.ID IN (
|
||||
SELECT {$wpdb->usermeta}.user_id
|
||||
FROM $wpdb->usermeta
|
||||
WHERE {$wpdb->usermeta}.meta_key = 'account_status' AND
|
||||
{$wpdb->usermeta}.meta_value = %s
|
||||
)",
|
||||
$status
|
||||
),
|
||||
$query->query_where
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets redirect URI after bulk action
|
||||
*
|
||||
* @param string $uri
|
||||
* @return string
|
||||
*/
|
||||
public function set_redirect_uri( $uri ) {
|
||||
if ( ! empty( $_REQUEST['s'] ) ) {
|
||||
$uri = add_query_arg( 's', sanitize_text_field( $_REQUEST['s'] ), $uri );
|
||||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['um_user_status'] ) ) {
|
||||
$uri = add_query_arg( 'um_user_status', sanitize_key( $_REQUEST['um_user_status'] ), $uri );
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add query args to list of query variable names to remove.
|
||||
*
|
||||
* @param array $removable_query_args An array of query variable names to remove from a URL
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_removable_query_args( $removable_query_args ) {
|
||||
$removable_query_args[] = '_um_wpnonce'; // need to add there additional nonce field because WordPress native _wpnonce field isn't visible on the users.php screen then custom actions
|
||||
$removable_query_args[] = 'approved_count';
|
||||
$removable_query_args[] = 'rejected_count';
|
||||
$removable_query_args[] = 'reactivated_count';
|
||||
$removable_query_args[] = 'deactivated_count';
|
||||
$removable_query_args[] = 'pending_count';
|
||||
$removable_query_args[] = 'resend_activation_count';
|
||||
return $removable_query_args;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Ajax_Hooks' ) ) {
|
||||
add_action( 'wp_ajax_um_member_directory_default_filter_settings', array( UM()->member_directory(), 'default_filter_settings' ) );
|
||||
|
||||
add_action( 'wp_ajax_um_same_page_update', array( UM()->admin_settings(), 'same_page_update_ajax' ) );
|
||||
|
||||
add_action( 'wp_ajax_um_get_users', array( UM()->users(), 'get_users' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,42 +33,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
|
||||
add_filter( 'display_post_states', array( &$this, 'add_display_post_states' ), 10, 2 );
|
||||
|
||||
add_filter( 'post_row_actions', array( &$this, 'remove_bulk_actions_um_form_inline' ), 10, 2 );
|
||||
|
||||
add_filter( 'manage_users_columns', array( &$this, 'manage_users_columns' ) );
|
||||
|
||||
add_filter( 'manage_users_custom_column', array( &$this, 'manage_users_custom_column' ), 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter: Add column 'Status'
|
||||
*
|
||||
* @param array $columns
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function manage_users_columns( $columns ) {
|
||||
$columns['account_status'] = __( 'Status', 'ultimate-member' );
|
||||
return $columns;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter: Show column 'Status'
|
||||
*
|
||||
* @param string $val
|
||||
* @param string $column_name
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function manage_users_custom_column( $val, $column_name, $user_id ) {
|
||||
if ( $column_name == 'account_status' ) {
|
||||
um_fetch_user( $user_id );
|
||||
$value = um_user( 'account_status_name' );
|
||||
um_reset_user();
|
||||
return $value;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -490,9 +490,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
case 'um_settings_updated':
|
||||
$messages[0]['content'] = __( 'Settings have been saved successfully.', 'ultimate-member' );
|
||||
break;
|
||||
case 'um_user_updated':
|
||||
$messages[0]['content'] = __( 'User has been updated.', 'ultimate-member' );
|
||||
break;
|
||||
case 'um_users_updated':
|
||||
$messages[0]['content'] = __( 'Users have been updated.', 'ultimate-member' );
|
||||
break;
|
||||
@@ -502,6 +499,36 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
case 'um_secure_restore':
|
||||
$messages[0]['content'] = __( 'Account has been successfully restored.', 'ultimate-member' );
|
||||
break;
|
||||
case 'um_approved':
|
||||
$approved_count = isset( $_REQUEST['approved_count'] ) ? absint( $_REQUEST['approved_count'] ) : 0;
|
||||
|
||||
$messages[0]['content'] = sprintf( _n( '<strong>%s</strong> user has been approved.', '<strong>%s</strong> users have been approved.', $approved_count, 'ultimate-member' ), $approved_count );
|
||||
break;
|
||||
case 'um_reactivated':
|
||||
$reactivated_count = isset( $_REQUEST['reactivated_count'] ) ? absint( $_REQUEST['reactivated_count'] ) : 0;
|
||||
|
||||
$messages[0]['content'] = sprintf( _n( '<strong>%s</strong> user has been reactivated.', '<strong>%s</strong> users have been reactivated.', $reactivated_count, 'ultimate-member' ), $reactivated_count );
|
||||
break;
|
||||
case 'um_rejected':
|
||||
$rejected_count = isset( $_REQUEST['rejected_count'] ) ? absint( $_REQUEST['rejected_count'] ) : 0;
|
||||
|
||||
$messages[0]['content'] = sprintf( _n( '<strong>%s</strong> user has been rejected.', '<strong>%s</strong> users have been rejected.', $rejected_count, 'ultimate-member' ), $rejected_count );
|
||||
break;
|
||||
case 'um_deactivate':
|
||||
$deactivated_count = isset( $_REQUEST['deactivated_count'] ) ? absint( $_REQUEST['deactivated_count'] ) : 0;
|
||||
|
||||
$messages[0]['content'] = sprintf( _n( '<strong>%s</strong> user has been deactivated.', '<strong>%s</strong> users have been deactivated.', $deactivated_count, 'ultimate-member' ), $deactivated_count );
|
||||
break;
|
||||
case 'um_pending':
|
||||
$pending_count = isset( $_REQUEST['pending_count'] ) ? absint( $_REQUEST['pending_count'] ) : 0;
|
||||
|
||||
$messages[0]['content'] = sprintf( _n( '<strong>%s</strong> user has been set as pending admin review.', '<strong>%s</strong> users have been set as pending admin review.', $pending_count, 'ultimate-member' ), $pending_count );
|
||||
break;
|
||||
case 'um_resend_activation':
|
||||
$resend_activation_count = isset( $_REQUEST['resend_activation_count'] ) ? absint( $_REQUEST['resend_activation_count'] ) : 0;
|
||||
|
||||
$messages[0]['content'] = sprintf( _n( 'Activation email for <strong>%s</strong> user has been sent.', 'Activation emails for <strong>%s</strong> users have been sent.', $resend_activation_count, 'ultimate-member' ), $resend_activation_count );
|
||||
break;
|
||||
default:
|
||||
/**
|
||||
* Filters the custom admin notice after um_adm_action.
|
||||
|
||||
@@ -638,7 +638,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
),
|
||||
array(
|
||||
'id' => 'restricted_block_message',
|
||||
'type' => 'textarea',
|
||||
'type' => 'wp_editor',
|
||||
'label' => __( 'Restricted Access Block Message', 'ultimate-member' ),
|
||||
'description' => __( 'This is the message shown to users that do not have permission to view the block\'s content.', 'ultimate-member' ),
|
||||
'conditional' => array( 'restricted_blocks', '=', 1 ),
|
||||
@@ -650,7 +650,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
'sanitize' => 'bool',
|
||||
);
|
||||
$settings_map['restricted_block_message'] = array(
|
||||
'sanitize' => 'textarea',
|
||||
'sanitize' => 'wp_kses',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,574 +0,0 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
|
||||
|
||||
/**
|
||||
* Class Admin_Users
|
||||
* @package um\admin\core
|
||||
*/
|
||||
class Admin_Users {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $custom_role = 'um_role';
|
||||
|
||||
/**
|
||||
* Admin_Users constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'restrict_manage_users', array( &$this, 'restrict_manage_users' ) );
|
||||
|
||||
add_filter( 'user_row_actions', array( &$this, 'user_row_actions' ), 10, 2 );
|
||||
|
||||
add_filter( 'user_has_cap', array( &$this, 'map_caps_by_role' ), 10, 4 );
|
||||
|
||||
add_filter( 'users_list_table_query_args', array( &$this, 'hide_by_caps' ), 1, 1 );
|
||||
|
||||
add_filter( 'pre_user_query', array( &$this, 'sort_by_newest' ) );
|
||||
|
||||
add_filter( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
|
||||
|
||||
add_filter( 'views_users', array( &$this, 'add_status_links' ) );
|
||||
|
||||
add_action( 'admin_init', array( &$this, 'um_bulk_users_edit' ), 9 );
|
||||
|
||||
add_action( 'um_admin_user_action_hook', array( &$this, 'user_action_hook' ), 10, 1 );
|
||||
}
|
||||
|
||||
public function get_users() {
|
||||
UM()->admin()->check_ajax_nonce();
|
||||
|
||||
$search_request = ! empty( $_REQUEST['search'] ) ? sanitize_text_field( $_REQUEST['search'] ) : '';
|
||||
$page = ! empty( $_REQUEST['page'] ) ? absint( $_REQUEST['page'] ) : 1;
|
||||
$per_page = 20;
|
||||
|
||||
$args = array(
|
||||
'fields' => array( 'ID', 'user_login' ),
|
||||
'paged' => $page,
|
||||
'number' => $per_page,
|
||||
);
|
||||
|
||||
if ( ! empty( $search_request ) ) {
|
||||
$args['search'] = '*' . $search_request . '*';
|
||||
}
|
||||
|
||||
$args = apply_filters( 'um_get_users_list_ajax_args', $args );
|
||||
|
||||
$users_query = new \WP_User_Query( $args );
|
||||
$users = $users_query->get_results();
|
||||
$total_count = $users_query->get_total();
|
||||
|
||||
if ( ! empty( $_REQUEST['avatar'] ) ) {
|
||||
foreach ( $users as $key => $user ) {
|
||||
$url = get_avatar_url( $user->ID );
|
||||
$users[ $key ]->img = $url;
|
||||
}
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'users' => $users,
|
||||
'total_count' => $total_count,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restrict the edit/delete users via wp-admin screen by the UM role capabilities
|
||||
*
|
||||
* @param $allcaps
|
||||
* @param $cap
|
||||
* @param $args
|
||||
* @param $user
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function map_caps_by_role( $allcaps, $cap, $args, $user ) {
|
||||
if ( isset( $cap[0] ) && $cap[0] == 'edit_users' ) {
|
||||
if ( isset( $args[0] ) && isset( $args[1] ) && ! user_can( $args[1], 'administrator' ) && $args[0] == 'edit_user' ) {
|
||||
if ( isset( $args[2] ) && ! UM()->roles()->um_current_user_can( 'edit', $args[2] ) ) {
|
||||
$allcaps[ $cap[0] ] = false;
|
||||
}
|
||||
}
|
||||
} elseif ( isset( $cap[0] ) && $cap[0] == 'delete_users' ) {
|
||||
if ( isset( $args[0] ) && isset( $args[1] ) && ! user_can( $args[1], 'administrator' ) && $args[0] == 'delete_user' ) {
|
||||
if ( isset( $args[2] ) && ! UM()->roles()->um_current_user_can( 'delete', $args[2] ) ) {
|
||||
$allcaps[ $cap[0] ] = false;
|
||||
}
|
||||
}
|
||||
} elseif ( isset( $cap[0] ) && $cap[0] == 'list_users' ) {
|
||||
if ( isset( $args[0] ) && isset( $args[1] ) && ! user_can( $args[1], 'administrator' ) && $args[0] == 'list_users' ) {
|
||||
if ( ! um_user( 'can_view_all' ) ) {
|
||||
$allcaps[ $cap[0] ] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $allcaps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does an action to user asap
|
||||
*
|
||||
* @param string $action
|
||||
*/
|
||||
public function user_action_hook( $action ) {
|
||||
switch ( $action ) {
|
||||
default:
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_admin_custom_hook_{$action}
|
||||
* @description Integration hook on user action
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_admin_custom_hook_{$action}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_admin_custom_hook_{$action}', 'my_admin_custom_hook', 10, 1 );
|
||||
* function my_admin_after_main_notices( $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_admin_custom_hook_{$action}", UM()->user()->id );
|
||||
break;
|
||||
|
||||
case 'um_put_as_pending':
|
||||
UM()->user()->pending();
|
||||
break;
|
||||
|
||||
case 'um_approve_membership':
|
||||
case 'um_reenable':
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ), 10, 1 );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ), 10, 1 );
|
||||
|
||||
UM()->user()->approve();
|
||||
break;
|
||||
|
||||
case 'um_reject_membership':
|
||||
UM()->user()->reject();
|
||||
break;
|
||||
|
||||
case 'um_resend_activation':
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->user(), 'add_activation_placeholder' ), 10, 1 );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->user(), 'add_activation_replace_placeholder' ), 10, 1 );
|
||||
|
||||
UM()->user()->email_pending();
|
||||
break;
|
||||
|
||||
case 'um_deactivate':
|
||||
UM()->user()->deactivate();
|
||||
break;
|
||||
|
||||
case 'um_delete':
|
||||
if ( is_admin() ) {
|
||||
wp_die( __( 'This action is not allowed in backend.', 'ultimate-member' ) );
|
||||
}
|
||||
UM()->user()->delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add UM Bulk actions to Users List Table
|
||||
*
|
||||
*/
|
||||
public function restrict_manage_users() {
|
||||
?>
|
||||
<div style="float:right;margin:0 4px">
|
||||
|
||||
<label class="screen-reader-text" for="um_bulk_action"><?php _e( 'UM Action', 'ultimate-member' ); ?></label>
|
||||
|
||||
<select name="um_bulk_action[]" id="um_bulk_action" class="" style="width: 200px">
|
||||
<option value="0"><?php _e( 'UM Action', 'ultimate-member' ); ?></option>
|
||||
<?php echo $this->get_bulk_admin_actions(); ?>
|
||||
</select>
|
||||
|
||||
<input name="um_bulkedit" id="um_bulkedit" class="button" value="<?php esc_attr_e( 'Apply', 'ultimate-member' ); ?>" type="submit" />
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ( ! empty( $_REQUEST['um_status'] ) ) { ?>
|
||||
<input type="hidden" name="um_status" id="um_status" value="<?php echo esc_attr( sanitize_key( $_REQUEST['um_status'] ) );?>"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get UM bulk actions HTML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_bulk_admin_actions() {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_bulk_user_actions_hook
|
||||
* @description Admin Users List Table bulk actions
|
||||
* @input_vars
|
||||
* [{"var":"$actions","type":"array","desc":"User List Table bulk actions"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_bulk_user_actions_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_bulk_user_actions_hook', 'my_admin_bulk_user_actions', 10, 1 );
|
||||
* function my_admin_bulk_user_actions( $actions ) {
|
||||
* // your code here
|
||||
* $actions['my-custom-bulk'] = array(
|
||||
* 'label' => 'My Custom Bulk Action'
|
||||
* );
|
||||
* return $actions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$actions = apply_filters( 'um_admin_bulk_user_actions_hook', array(
|
||||
'um_approve_membership' => array(
|
||||
'label' => __( 'Approve Membership', 'ultimate-member' )
|
||||
),
|
||||
'um_reject_membership' => array(
|
||||
'label' => __( 'Reject Membership', 'ultimate-member' )
|
||||
),
|
||||
'um_put_as_pending' => array(
|
||||
'label' => __( 'Put as Pending Review', 'ultimate-member' )
|
||||
),
|
||||
'um_resend_activation' => array(
|
||||
'label' => __( 'Resend Activation Email', 'ultimate-member' )
|
||||
),
|
||||
'um_deactivate' => array(
|
||||
'label' => __( 'Deactivate', 'ultimate-member' )
|
||||
),
|
||||
'um_reenable' => array(
|
||||
'label' => __( 'Reactivate', 'ultimate-member' )
|
||||
)
|
||||
) );
|
||||
|
||||
$output = '';
|
||||
foreach ( $actions as $id => $action_data ) {
|
||||
$output .= '<option value="' . $id . '" '. disabled( isset( $arr['disabled'] ), true, false ) . '>' . $action_data['label'] . '</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom row actions for users page
|
||||
*
|
||||
* @param array $actions
|
||||
* @param $user_object \WP_User
|
||||
* @return array
|
||||
*/
|
||||
public function user_row_actions( $actions, $user_object ) {
|
||||
$user_id = $user_object->ID;
|
||||
|
||||
$actions['frontend_profile'] = '<a href="' . esc_url( um_user_profile_url( $user_id ) ) . '">' . __( 'View profile', 'ultimate-member' ) . '</a>';
|
||||
|
||||
$submitted = get_user_meta( $user_id, 'submitted', true );
|
||||
if ( ! empty( $submitted ) ) {
|
||||
$actions['view_info'] = '<a href="javascript:void(0);" data-modal="UM_preview_registration" data-modal-size="smaller"
|
||||
data-dynamic-content="um_admin_review_registration" data-arg1="' . esc_attr( $user_id ) . '" data-arg2="edit_registration">' . __( 'Info', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'administrator' ) ) {
|
||||
if ( ! um_can_view_profile( $user_id ) ) {
|
||||
unset( $actions['frontend_profile'] );
|
||||
unset( $actions['view_info'] );
|
||||
unset( $actions['view'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_user_row_actions
|
||||
* @description Admin views array
|
||||
* @input_vars
|
||||
* [{"var":"$actions","type":"array","desc":"User List Table actions"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_user_row_actions', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_user_row_actions', 'my_admin_user_row_actions', 10, 2 );
|
||||
* function my_admin_user_row_actions( $actions, $user_id ) {
|
||||
* // your code here
|
||||
* return $actions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$actions = apply_filters( 'um_admin_user_row_actions', $actions, $user_id );
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change default sorting at WP Users list table
|
||||
*
|
||||
* @param array $args
|
||||
* @return array
|
||||
*/
|
||||
public function hide_by_caps( $args ) {
|
||||
if ( ! current_user_can( 'administrator' ) ) {
|
||||
$can_view_roles = um_user( 'can_view_roles' );
|
||||
if ( um_user( 'can_view_all' ) && ! empty( $can_view_roles ) ) {
|
||||
$args['role__in'] = $can_view_roles;
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change default sorting at WP Users list table
|
||||
*
|
||||
* @param $query
|
||||
* @return mixed
|
||||
*/
|
||||
public function sort_by_newest( $query ) {
|
||||
global $pagenow;
|
||||
|
||||
if ( is_admin() && 'users.php' === $pagenow ) {
|
||||
if ( ! isset( $_REQUEST['orderby'] ) ) {
|
||||
$query->query_vars['order'] = 'desc';
|
||||
$query->query_orderby = ' ORDER BY user_registered ' . ( 'desc' === $query->query_vars['order'] ? 'desc ' : 'asc ' ); //set sort order
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter WP users by UM Status
|
||||
*
|
||||
* @param $query
|
||||
* @return mixed
|
||||
*/
|
||||
public function filter_users_by_status( $query ) {
|
||||
global $wpdb, $pagenow;
|
||||
if ( is_admin() && 'users.php' === $pagenow && ! empty( $_REQUEST['um_status'] ) ) {
|
||||
|
||||
$status = sanitize_key( $_REQUEST['um_status'] );
|
||||
|
||||
if ( 'needs-verification' === $status ) {
|
||||
$query->query_where = str_replace('WHERE 1=1',
|
||||
"WHERE 1=1 AND {$wpdb->users}.ID IN (
|
||||
SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
|
||||
WHERE {$wpdb->usermeta}.meta_key = '_um_verified'
|
||||
AND {$wpdb->usermeta}.meta_value = 'pending')",
|
||||
$query->query_where
|
||||
);
|
||||
} else {
|
||||
$query->query_where = str_replace('WHERE 1=1',
|
||||
"WHERE 1=1 AND {$wpdb->users}.ID IN (
|
||||
SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
|
||||
WHERE {$wpdb->usermeta}.meta_key = 'account_status'
|
||||
AND {$wpdb->usermeta}.meta_value = '{$status}')",
|
||||
$query->query_where
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add status links to WP Users List Table
|
||||
*
|
||||
* @param $views
|
||||
* @return array
|
||||
*/
|
||||
public function add_status_links( $views ) {
|
||||
remove_filter( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
|
||||
|
||||
$old_views = $views;
|
||||
$views = array();
|
||||
|
||||
if ( ! isset( $_REQUEST['role'] ) && ! isset( $_REQUEST['um_status'] ) ) {
|
||||
$views['all'] = '<a href="' . admin_url( 'users.php' ) . '" class="current">' . __( 'All', 'ultimate-member' ) . ' <span class="count">(' . UM()->query()->count_users() . ')</span></a>';
|
||||
} else {
|
||||
$views['all'] = '<a href="' . admin_url( 'users.php' ) . '">' . __( 'All', 'ultimate-member' ) . ' <span class="count">(' . UM()->query()->count_users() . ')</span></a>';
|
||||
}
|
||||
|
||||
$status = array(
|
||||
'approved' => __( 'Approved', 'ultimate-member' ),
|
||||
'awaiting_admin_review' => __( 'Pending review', 'ultimate-member' ),
|
||||
'awaiting_email_confirmation' => __( 'Waiting email confirmation', 'ultimate-member' ),
|
||||
'inactive' => __( 'Inactive', 'ultimate-member' ),
|
||||
'rejected' => __( 'Rejected', 'ultimate-member' ),
|
||||
);
|
||||
|
||||
// set default statuses if not already done
|
||||
UM()->setup()->set_default_user_status();
|
||||
|
||||
foreach ( $status as $k => $v ) {
|
||||
if ( isset( $_REQUEST['um_status'] ) && sanitize_key( $_REQUEST['um_status'] ) === $k ) {
|
||||
$current = 'class="current"';
|
||||
} else {
|
||||
$current = '';
|
||||
}
|
||||
|
||||
$views[ $k ] = '<a href="' . esc_url( admin_url( 'users.php' ) . '?um_status=' . $k ) . '" ' . $current . '>' . $v . ' <span class="count">(' . UM()->query()->count_users_by_status( $k ) . ')</span></a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_views_users
|
||||
* @description Admin views array
|
||||
* @input_vars
|
||||
* [{"var":"$views","type":"array","desc":"User Views"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_views_users', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_views_users', 'my_admin_views_users', 10, 1 );
|
||||
* function my_admin_views_users( $views ) {
|
||||
* // your code here
|
||||
* return $views;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$views = apply_filters( 'um_admin_views_users', $views );
|
||||
|
||||
// remove all filters
|
||||
unset( $old_views['all'] );
|
||||
|
||||
// add separator
|
||||
$views['subsep'] = '<span></span>';
|
||||
|
||||
// merge views
|
||||
foreach ( $old_views as $key => $view ) {
|
||||
$views[ $key ] = $view;
|
||||
}
|
||||
|
||||
// hide filters with not accessible roles
|
||||
if ( ! current_user_can( 'administrator' ) ) {
|
||||
$wp_roles = wp_roles();
|
||||
$can_view_roles = um_user( 'can_view_roles' );
|
||||
if ( ! empty( $can_view_roles ) ) {
|
||||
foreach ( $wp_roles->get_names() as $this_role => $name ) {
|
||||
if ( ! in_array( $this_role, $can_view_roles, true ) ) {
|
||||
unset( $views[ $this_role ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk user editing actions
|
||||
*/
|
||||
public function um_bulk_users_edit() {
|
||||
// bulk edit users
|
||||
if ( ! empty( $_REQUEST['users'] ) && ! empty( $_REQUEST['um_bulkedit'] ) && ! empty( $_REQUEST['um_bulk_action'] ) ) {
|
||||
|
||||
$rolename = UM()->roles()->get_priority_user_role( get_current_user_id() );
|
||||
$role = get_role( $rolename );
|
||||
|
||||
if ( ! current_user_can( 'edit_users' ) && ! $role->has_cap( 'edit_users' ) ) {
|
||||
wp_die( esc_html__( 'You do not have enough permissions to do that.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
check_admin_referer( 'bulk-users' );
|
||||
|
||||
$users = array_map( 'absint', (array) $_REQUEST['users'] );
|
||||
$bulk_action = current( array_filter( $_REQUEST['um_bulk_action'] ) );
|
||||
|
||||
foreach ( $users as $user_id ) {
|
||||
UM()->user()->set( $user_id );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_admin_user_action_hook
|
||||
* @description Action on bulk user action
|
||||
* @input_vars
|
||||
* [{"var":"$bulk_action","type":"string","desc":"Bulk Action"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_admin_user_action_hook{$action}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_admin_user_action_hook', 'my_admin_user_action', 10, 1 );
|
||||
* function my_admin_user_action( $bulk_action ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_admin_user_action_hook', $bulk_action );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_admin_user_action_{$bulk_action}_hook
|
||||
* @description Action on bulk user action
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_admin_user_action_{$bulk_action}_hook', 'function_name', 10 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_admin_user_action_{$bulk_action}_hook', 'my_admin_user_action', 10 );
|
||||
* function my_admin_user_action() {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_admin_user_action_{$bulk_action}_hook" );
|
||||
}
|
||||
|
||||
$uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
|
||||
$uri = add_query_arg( 'update', 'um_users_updated', $uri );
|
||||
|
||||
wp_redirect( $uri );
|
||||
exit;
|
||||
} elseif ( ! empty( $_REQUEST['um_bulkedit'] ) ) {
|
||||
|
||||
$uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
|
||||
wp_redirect( $uri );
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets redirect URI after bulk action
|
||||
*
|
||||
* @param string $uri
|
||||
* @return string
|
||||
*/
|
||||
public function set_redirect_uri( $uri ) {
|
||||
|
||||
if ( ! empty( $_REQUEST['s'] ) ) {
|
||||
$uri = add_query_arg( 's', sanitize_text_field( $_REQUEST['s'] ), $uri );
|
||||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['um_status'] ) ) {
|
||||
$uri = add_query_arg( 'um_status', sanitize_key( $_REQUEST['um_status'] ), $uri );
|
||||
}
|
||||
|
||||
return $uri;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,70 +3,70 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<table id="um-users-overview-table">
|
||||
<tr>
|
||||
<td>
|
||||
<span>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php' ) ); ?>">
|
||||
<?php echo UM()->query()->count_users(); ?>
|
||||
<?php echo esc_html( UM()->query()->count_users() ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php' ) ); ?>">
|
||||
<?php _e( 'Users', 'ultimate-member' ); ?>
|
||||
<?php esc_html_e( 'Users', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_admin_review' ) ); ?>">
|
||||
<?php echo UM()->query()->count_users_by_status( 'awaiting_admin_review' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_admin_review' ) ); ?>" class="warning">
|
||||
<?php _e( 'Pending Review', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_user_status=awaiting_admin_review' ) ); ?>">
|
||||
<?php echo esc_html( UM()->query()->count_users_by_status( 'awaiting_admin_review' ) ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_user_status=awaiting_admin_review' ) ); ?>" class="warning">
|
||||
<?php esc_html_e( 'Pending Review', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=approved' ) ); ?>">
|
||||
<?php echo UM()->query()->count_users_by_status( 'approved' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=approved' ) ); ?>">
|
||||
<?php _e( 'Approved', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_user_status=approved' ) ); ?>">
|
||||
<?php echo esc_html( UM()->query()->count_users_by_status( 'approved' ) ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_user_status=approved' ) ); ?>">
|
||||
<?php esc_html_e( 'Approved', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_email_confirmation' ) ); ?>">
|
||||
<?php echo UM()->query()->count_users_by_status( 'awaiting_email_confirmation' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_email_confirmation' ) ); ?>" class="warning">
|
||||
<?php _e( 'Awaiting Email Confirmation', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_user_status=awaiting_email_confirmation' ) ); ?>">
|
||||
<?php echo esc_html( UM()->query()->count_users_by_status( 'awaiting_email_confirmation' ) ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_user_status=awaiting_email_confirmation' ) ); ?>" class="warning">
|
||||
<?php esc_html_e( 'Awaiting Email Confirmation', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=rejected' ) ); ?>">
|
||||
<?php echo UM()->query()->count_users_by_status( 'rejected' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=rejected' ) ); ?>">
|
||||
<?php _e( 'Rejected', 'ultimate-member' ); ?>
|
||||
</a></span>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_user_status=rejected' ) ); ?>">
|
||||
<?php echo esc_html( UM()->query()->count_users_by_status( 'rejected' ) ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_user_status=rejected' ) ); ?>">
|
||||
<?php esc_html_e( 'Rejected', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=inactive' ) ); ?>">
|
||||
<?php echo UM()->query()->count_users_by_status( 'inactive' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=inactive' ) ); ?>">
|
||||
<?php _e( 'Inactive', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_user_status=inactive' ) ); ?>">
|
||||
<?php echo esc_html( UM()->query()->count_users_by_status( 'inactive' ) ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( 'users.php?um_user_status=inactive' ) ); ?>">
|
||||
<?php esc_html_e( 'Inactive', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,61 +1,66 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
$role = $object['data'];
|
||||
?>
|
||||
<div class="um-admin-metabox">
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-admin um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_can_access_wpadmin',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Can access wp-admin?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'The core admin role must always have access to wp-admin / WordPress backend', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_access_wpadmin'] ) ? $role['_um_can_access_wpadmin'] : 0,
|
||||
<?php
|
||||
UM()->admin_forms(
|
||||
array(
|
||||
'class' => 'um-role-admin um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_can_access_wpadmin',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Can access wp-admin?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'The core admin role must always have access to wp-admin / WordPress backend', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_access_wpadmin'] ) ? $role['_um_can_access_wpadmin'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_not_see_adminbar',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Force hiding adminbar in frontend?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Mark this option if you need to hide the adminbar on frontend for this role', 'ultimate-member' ),
|
||||
'value' => isset( $role['_um_can_not_see_adminbar'] ) ? $role['_um_can_not_see_adminbar'] : 1,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_edit_everyone',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Can edit other member accounts?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_edit_everyone'] ) ? $role['_um_can_edit_everyone'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_edit_roles',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Can edit these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Multiple selections of which roles this role can edit, none selected to allow this role to edit all member roles.', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_edit_roles'] ) ? $role['_um_can_edit_roles'] : array(),
|
||||
'conditional' => array( '_um_can_edit_everyone', '=', '1' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_delete_everyone',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Can delete other member accounts?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Allow this role to delete other user accounts.', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_delete_everyone'] ) ? $role['_um_can_delete_everyone'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_delete_roles',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Can delete these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Multiple selections of which roles this role can delete, none selected to allow this role to delete all member roles', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_delete_roles'] ) ? $role['_um_can_delete_roles'] : array(),
|
||||
'conditional' => array( '_um_can_delete_everyone', '=', '1' ),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_not_see_adminbar',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Force hiding adminbar in frontend?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Mark this option if you need to hide the adminbar on frontend for this role', 'ultimate-member' ),
|
||||
'value' => isset( $role['_um_can_not_see_adminbar'] ) ? $role['_um_can_not_see_adminbar'] : 1,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_edit_everyone',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Can edit other member accounts?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_edit_everyone'] ) ? $role['_um_can_edit_everyone'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_edit_roles',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Can edit these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Which roles that role can edit, choose none to allow role to edit all member roles', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_edit_roles'] ) ? $role['_um_can_edit_roles'] : array(),
|
||||
'conditional' => array( '_um_can_edit_everyone', '=', '1' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_delete_everyone',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Can delete other member accounts?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Allow this role to delete other user accounts.', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_delete_everyone'] ) ? $role['_um_can_delete_everyone'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_delete_roles',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Can delete these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Which roles that role can edit, choose none to allow role to edit all member roles', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_delete_roles'] ) ? $role['_um_can_delete_roles'] : array(),
|
||||
'conditional' => array( '_um_can_delete_everyone', '=', '1' )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
)->render_form();
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -1,61 +1,65 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
$role = $object['data'];
|
||||
?>
|
||||
<div class="um-admin-metabox">
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-profile um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_can_view_all',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Can view other member profiles?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role view all member profiles?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_view_all'] ) ? $role['_um_can_view_all'] : 0,
|
||||
<?php
|
||||
UM()->admin_forms(
|
||||
array(
|
||||
'class' => 'um-role-profile um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_can_view_all',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Can view other member profiles?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role view all member profiles?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_view_all'] ) ? $role['_um_can_view_all'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_view_roles',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Can view these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Multiple selections of which roles this role can view, none selected to allow this role to view all member roles.', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_view_roles'] ) ? $role['_um_can_view_roles'] : array(),
|
||||
'conditional' => array( '_um_can_view_all', '=', '1' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_make_private_profile',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_make_private_profile',
|
||||
'label' => __( 'Can make their profile private?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role make their profile private?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_make_private_profile'] ) ? $role['_um_can_make_private_profile'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_access_private_profile',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_access_private_profile',
|
||||
'label' => __( 'Can view/access private profiles?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role view private profiles?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_access_private_profile'] ) ? $role['_um_can_access_private_profile'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_noindex',
|
||||
'type' => 'select',
|
||||
'size' => 'medium',
|
||||
'name' => '_um_profile_noindex',
|
||||
'label' => __( 'Avoid indexing profile by search engines', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Hides the profile page for robots. The default value depends on the General > Users setting.', 'ultimate-member' ),
|
||||
'options' => array(
|
||||
'' => __( 'Default', 'ultimate-member' ),
|
||||
'0' => __( 'No', 'ultimate-member' ),
|
||||
'1' => __( 'Yes', 'ultimate-member' ),
|
||||
),
|
||||
'value' => array_key_exists( '_um_profile_noindex', $role ) ? $role['_um_profile_noindex'] : '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_view_roles',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Can view these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Which roles that role can view, choose none to allow role to view all member roles', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_view_roles'] ) ? $role['_um_can_view_roles'] : array(),
|
||||
'conditional' => array( '_um_can_view_all', '=', '1' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_make_private_profile',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_make_private_profile',
|
||||
'label' => __( 'Can make their profile private?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role make their profile private?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_make_private_profile'] ) ? $role['_um_can_make_private_profile'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_access_private_profile',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_access_private_profile',
|
||||
'label' => __( 'Can view/access private profiles?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role view private profiles?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_access_private_profile'] ) ? $role['_um_can_access_private_profile'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_noindex',
|
||||
'type' => 'select',
|
||||
'size' => 'medium',
|
||||
'name' => '_um_profile_noindex',
|
||||
'label' => __( 'Avoid indexing profile by search engines', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Hides the profile page for robots. The default value depends on the General > Users setting.', 'ultimate-member' ),
|
||||
'options' => [
|
||||
'' => __( 'Default', 'ultimate-member' ),
|
||||
'0' => __( 'No', 'ultimate-member' ),
|
||||
'1' => __( 'Yes', 'ultimate-member' ),
|
||||
],
|
||||
'value' => array_key_exists( '_um_profile_noindex', $role ) ? $role['_um_profile_noindex'] : '',
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
</div>
|
||||
)->render_form();
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,7 @@ if ( ! class_exists( 'um\ajax\Init' ) ) {
|
||||
$this->forms();
|
||||
$this->pages();
|
||||
$this->secure();
|
||||
$this->users();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,5 +61,17 @@ if ( ! class_exists( 'um\ajax\Init' ) ) {
|
||||
}
|
||||
return UM()->classes['um\ajax\secure'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @return Users
|
||||
*/
|
||||
public function users() {
|
||||
if ( empty( UM()->classes['um\ajax\users'] ) ) {
|
||||
UM()->classes['um\ajax\users'] = new Users();
|
||||
}
|
||||
return UM()->classes['um\ajax\users'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ class Secure {
|
||||
$content .= ' <a href="' . esc_url( $lock_register_forms_url ) . '" target="_blank">' . esc_html__( 'Click here to lock them now.', 'ultimate-member' ) . '</a>';
|
||||
$content .= ' ' . esc_html__( 'You can unblock the Register forms later. Just go to Ultimate Member > Settings > Advanced > Security and uncheck the option "Lock All Register Forms".', 'ultimate-member' );
|
||||
$content .= $br . $br;
|
||||
$suspicious_accounts_url = admin_url( 'users.php?um_status=inactive' );
|
||||
$suspicious_accounts_url = admin_url( 'users.php?um_user_status=inactive' );
|
||||
|
||||
if ( $might_affected_users->get_total() > 0 ) {
|
||||
$od = gmdate( 'F d, Y', $oldest_date );
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace um\ajax;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Users
|
||||
*
|
||||
* @package um\ajax
|
||||
*/
|
||||
class Users {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wp_ajax_um_get_users', array( $this, 'get_users' ) );
|
||||
}
|
||||
|
||||
public function get_users() {
|
||||
UM()->admin()->check_ajax_nonce();
|
||||
|
||||
$search_request = ! empty( $_REQUEST['search'] ) ? sanitize_text_field( $_REQUEST['search'] ) : '';
|
||||
$page = ! empty( $_REQUEST['page'] ) ? absint( $_REQUEST['page'] ) : 1;
|
||||
$per_page = 20;
|
||||
|
||||
$args = array(
|
||||
'fields' => array( 'ID', 'user_login' ),
|
||||
'paged' => $page,
|
||||
'number' => $per_page,
|
||||
);
|
||||
|
||||
if ( ! empty( $search_request ) ) {
|
||||
$args['search'] = '*' . $search_request . '*';
|
||||
}
|
||||
|
||||
$args = apply_filters( 'um_get_users_list_ajax_args', $args );
|
||||
|
||||
$users_query = new \WP_User_Query( $args );
|
||||
$users = $users_query->get_results();
|
||||
$total_count = $users_query->get_total();
|
||||
|
||||
if ( ! empty( $_REQUEST['avatar'] ) ) {
|
||||
foreach ( $users as $key => $user ) {
|
||||
$url = get_avatar_url( $user->ID );
|
||||
$users[ $key ]->img = $url;
|
||||
}
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'users' => $users,
|
||||
'total_count' => $total_count,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -709,7 +709,7 @@ if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
),
|
||||
);
|
||||
|
||||
$allowed_html = array_merge( $global_allowed, $allowed_html );
|
||||
$allowed_html = array_merge_recursive( $global_allowed, $allowed_html );
|
||||
$allowed_html = array_map( '_wp_add_global_attributes', $allowed_html );
|
||||
|
||||
/**
|
||||
|
||||
+1
-16
@@ -526,7 +526,6 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->admin_settings();
|
||||
$this->columns();
|
||||
$this->metabox();
|
||||
$this->users();
|
||||
$this->dragdrop();
|
||||
$this->admin_gdpr();
|
||||
$this->admin_navmenu();
|
||||
@@ -902,20 +901,6 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
return $this->classes['admin_metabox'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
*
|
||||
* @return um\admin\core\Admin_Users()
|
||||
*/
|
||||
function users() {
|
||||
if ( empty( $this->classes['admin_users'] ) ) {
|
||||
$this->classes['admin_users'] = new um\admin\core\Admin_Users();
|
||||
}
|
||||
return $this->classes['admin_users'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -1466,7 +1451,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
require_once 'core/um-actions-form.php';
|
||||
require_once 'core/um-actions-access.php';
|
||||
require_once 'core/um-actions-wpadmin.php';
|
||||
require_once 'core/um-actions-core.php';
|
||||
// require_once 'core/um-actions-core.php';
|
||||
require_once 'core/um-actions-ajax.php';
|
||||
require_once 'core/um-actions-login.php';
|
||||
require_once 'core/um-actions-register.php';
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
<?php
|
||||
namespace um\common;
|
||||
|
||||
use WP_Filesystem_Base;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Filesystem
|
||||
*
|
||||
* @package um\common
|
||||
*/
|
||||
class Filesystem {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public $upload_dir = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public $upload_url = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public $temp_upload_dir = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public $temp_upload_url = '';
|
||||
|
||||
/**
|
||||
* Filesystem constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->init_paths();
|
||||
}
|
||||
|
||||
/**
|
||||
* Init uploading URL and directory
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public function init_paths() {
|
||||
$this->temp_upload_dir = $this->get_upload_dir( 'ultimatemember/temp' );
|
||||
$this->temp_upload_url = $this->get_upload_url( 'ultimatemember/temp' );
|
||||
}
|
||||
|
||||
public function files_age() {
|
||||
/**
|
||||
* Filters the maximum file age in the temp folder. By default, it's 24 hours.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_filesystem_max_file_age
|
||||
*
|
||||
* @param {int} $file_age Temp file age in seconds.
|
||||
*
|
||||
* @return {int} Temp file age in seconds.
|
||||
*/
|
||||
return apply_filters( 'um_filesystem_max_file_age', 24 * HOUR_IN_SECONDS ); // Temp file age in seconds
|
||||
}
|
||||
|
||||
public static function image_mimes( $context = 'list' ) {
|
||||
$mimes = array();
|
||||
|
||||
static $allowed_for_user = null;
|
||||
if ( empty( $allowed_for_user ) ) {
|
||||
$allowed_for_user = get_allowed_mime_types();
|
||||
}
|
||||
|
||||
if ( empty( $allowed_for_user ) ) {
|
||||
return $mimes;
|
||||
}
|
||||
|
||||
if ( 'list' === $context ) {
|
||||
$all_mimes = wp_get_ext_types();
|
||||
$mimes = array_key_exists( 'image', $all_mimes ) ? $all_mimes['image'] : array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'heic', 'webp', 'avif' );
|
||||
|
||||
$all_extensions = array();
|
||||
foreach ( $allowed_for_user as $extensions => $mime ) {
|
||||
$all_extensions[] = explode( '|', $extensions );
|
||||
}
|
||||
$all_extensions = array_merge( ...$all_extensions );
|
||||
$mimes = array_intersect( $mimes, $all_extensions );
|
||||
|
||||
/**
|
||||
* Filters the MIME-types of the images that can be uploaded as Company Logo.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_upload_image_mimes_list
|
||||
*
|
||||
* @param {array} $mime_types MIME types.
|
||||
*
|
||||
* @return {array} MIME types.
|
||||
*/
|
||||
$mimes = apply_filters( 'um_upload_image_mimes_list', $mimes );
|
||||
} elseif ( 'allowed' === $context ) {
|
||||
$mimes = array(
|
||||
'jpg|jpeg|jpe' => 'image/jpeg',
|
||||
'gif' => 'image/gif',
|
||||
'png' => 'image/png',
|
||||
'bmp' => 'image/bmp',
|
||||
'tiff|tif' => 'image/tiff',
|
||||
'webp' => 'image/webp',
|
||||
'avif' => 'image/avif',
|
||||
'ico' => 'image/x-icon',
|
||||
'heic' => 'image/heic',
|
||||
);
|
||||
|
||||
$mimes = array_intersect( $mimes, $allowed_for_user );
|
||||
|
||||
/**
|
||||
* Filters the MIME-types of the images that can be uploaded via UM uploader
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_upload_allowed_image_mimes
|
||||
*
|
||||
* @param {array} $mime_types MIME types.
|
||||
*
|
||||
* @return {array} MIME types.
|
||||
*/
|
||||
$mimes = apply_filters( 'um_upload_allowed_image_mimes', $mimes );
|
||||
}
|
||||
|
||||
return $mimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all files, which are older than 24 hours
|
||||
*
|
||||
* Can duplicate this function functionality `remove_old_files`
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public function clear_temp_dir() {
|
||||
global $wp_filesystem;
|
||||
|
||||
if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
|
||||
$credentials = request_filesystem_credentials( site_url() );
|
||||
WP_Filesystem( $credentials );
|
||||
}
|
||||
|
||||
if ( ! $wp_filesystem->is_dir( $this->temp_upload_dir ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
|
||||
$dir = @opendir( $this->temp_upload_dir );
|
||||
if ( ! $dir ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition -- reading folder's content here
|
||||
while ( false !== ( $file = readdir( $dir ) ) ) {
|
||||
if ( '.' === $file || '..' === $file ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filepath = wp_normalize_path( $this->temp_upload_dir . DIRECTORY_SEPARATOR . $file );
|
||||
|
||||
// Remove temp file if it is older than the max age and is not the current file
|
||||
if ( $wp_filesystem->mtime( $filepath ) < time() - $this->files_age() ) {
|
||||
$wp_filesystem->delete( $filepath );
|
||||
}
|
||||
}
|
||||
|
||||
@closedir( $dir );
|
||||
// phpcs:enable WordPress.PHP.NoSilencedErrors.Discouraged
|
||||
}
|
||||
|
||||
/**
|
||||
* Get upload dir of plugin
|
||||
*
|
||||
* @param string $dir
|
||||
* @param int|null $blog_id
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public function get_upload_dir( $dir = '', $blog_id = null ) {
|
||||
// Please add define('FS_METHOD', 'direct'); to avoid question about FTP.
|
||||
global $wp_filesystem;
|
||||
|
||||
if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
|
||||
$credentials = request_filesystem_credentials( site_url() );
|
||||
WP_Filesystem( $credentials );
|
||||
}
|
||||
|
||||
if ( ! $blog_id ) {
|
||||
$blog_id = get_current_blog_id();
|
||||
} elseif ( is_multisite() ) {
|
||||
switch_to_blog( $blog_id );
|
||||
}
|
||||
|
||||
if ( empty( $this->upload_dir[ $blog_id ] ) ) {
|
||||
$uploads = wp_upload_dir();
|
||||
if ( ! empty( $uploads['error'] ) ) {
|
||||
return '';
|
||||
}
|
||||
$this->upload_dir[ $blog_id ] = $uploads['basedir'];
|
||||
}
|
||||
|
||||
$upload_dir = wp_normalize_path( trailingslashit( $this->upload_dir[ $blog_id ] ) . untrailingslashit( $dir ) );
|
||||
|
||||
if ( ! $wp_filesystem->is_dir( $upload_dir ) ) {
|
||||
wp_mkdir_p( $upload_dir );
|
||||
}
|
||||
|
||||
if ( is_multisite() ) {
|
||||
restore_current_blog();
|
||||
}
|
||||
|
||||
//return dir path
|
||||
return $upload_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get upload url of plugin
|
||||
*
|
||||
* @param string $url
|
||||
* @param int|null $blog_id
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public function get_upload_url( $url = '', $blog_id = null ) {
|
||||
if ( ! $blog_id ) {
|
||||
$blog_id = get_current_blog_id();
|
||||
} elseif ( is_multisite() ) {
|
||||
switch_to_blog( $blog_id );
|
||||
}
|
||||
|
||||
if ( empty( $this->upload_url[ $blog_id ] ) ) {
|
||||
$uploads = wp_upload_dir();
|
||||
if ( ! empty( $uploads['error'] ) ) {
|
||||
return '';
|
||||
}
|
||||
$this->upload_url[ $blog_id ] = $uploads['baseurl'];
|
||||
}
|
||||
|
||||
$upload_url = trailingslashit( $this->upload_url[ $blog_id ] ) . untrailingslashit( $url );
|
||||
|
||||
if ( is_multisite() ) {
|
||||
restore_current_blog();
|
||||
}
|
||||
|
||||
//return dir path
|
||||
return $upload_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format Bytes
|
||||
*
|
||||
* @param int $size
|
||||
* @param int $precision
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public static function format_bytes( $size, $precision = 1 ) {
|
||||
if ( is_numeric( $size ) ) {
|
||||
$base = log( $size, 1024 );
|
||||
$suffixes = array( '', 'kb', 'MB', 'GB', 'TB' );
|
||||
|
||||
$computed_size = round( 1024 ** ( $base - floor( $base ) ), $precision );
|
||||
$unit = $suffixes[ absint( floor( $base ) ) ];
|
||||
|
||||
return $computed_size . ' ' . $unit;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
$this->secure()->hooks();
|
||||
$this->site_health();
|
||||
$this->theme()->hooks();
|
||||
$this->users()->hooks();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,6 +40,18 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
return UM()->classes['um\common\cpt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @return Filesystem
|
||||
*/
|
||||
public function filesystem() {
|
||||
if ( empty( UM()->classes['um\common\filesystem'] ) ) {
|
||||
UM()->classes['um\common\filesystem'] = new Filesystem();
|
||||
}
|
||||
return UM()->classes['um\common\filesystem'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.6.8
|
||||
*
|
||||
@@ -86,5 +99,17 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
}
|
||||
return UM()->classes['um\common\theme'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @return Users
|
||||
*/
|
||||
public function users() {
|
||||
if ( empty( UM()->classes['um\common\users'] ) ) {
|
||||
UM()->classes['um\common\users'] = new Users();
|
||||
}
|
||||
return UM()->classes['um\common\users'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,9 +229,11 @@ if ( ! class_exists( 'um\common\Secure' ) ) {
|
||||
$user->update_user_level_from_caps();
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
UM()->user()->set_status( 'inactive' );
|
||||
//UM()->user()->set_status( 'inactive' );
|
||||
UM()->common()->users()->set_status( $user->ID, 'inactive' );
|
||||
} else {
|
||||
UM()->user()->set_status( 'rejected' );
|
||||
//UM()->user()->set_status( 'rejected' );
|
||||
UM()->common()->users()->set_status( $user->ID, 'rejected' );
|
||||
}
|
||||
um_reset_user();
|
||||
update_user_meta( $user->ID, 'um_user_blocked', 'suspicious_activity' );
|
||||
|
||||
@@ -106,6 +106,8 @@ class Theme {
|
||||
$scan_files = self::get_all_templates();
|
||||
foreach ( $scan_files as $key => $files ) {
|
||||
foreach ( $files as $file ) {
|
||||
$file = wp_normalize_path( $file ); // for not a Linux hosting.
|
||||
|
||||
if ( false === strpos( $file, 'email/' ) ) {
|
||||
/**
|
||||
* Filters an array of the template files for scanning versions based on $key.
|
||||
@@ -133,8 +135,8 @@ class Theme {
|
||||
'profile/comments-single.php',
|
||||
'profile/posts.php',
|
||||
'profile/posts-single.php',
|
||||
'modal/um_upload_single.php',
|
||||
'modal/um_view_photo.php',
|
||||
'modal/upload-single.php',
|
||||
'modal/view-photo.php',
|
||||
);
|
||||
|
||||
$theme_file = false;
|
||||
|
||||
@@ -0,0 +1,819 @@
|
||||
<?php
|
||||
namespace um\common;
|
||||
|
||||
use WP_Error;
|
||||
use WP_Session_Tokens;
|
||||
use WP_User;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Users
|
||||
*
|
||||
* @package um\common
|
||||
*/
|
||||
class Users {
|
||||
|
||||
public function hooks() {
|
||||
add_filter( 'user_has_cap', array( &$this, 'map_caps_by_role' ), 10, 3 );
|
||||
add_filter( 'editable_roles', array( &$this, 'restrict_roles' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Restrict the edit/delete users via wp-admin screen due UM role capabilities
|
||||
*
|
||||
* @param bool[] $allcaps Array of key/value pairs where keys represent a capability name
|
||||
* and boolean values represent whether the user has that capability.
|
||||
* @param string[] $caps Required primitive capabilities for the requested capability.
|
||||
* @param array $args {
|
||||
* Arguments that accompany the requested capability check.
|
||||
*
|
||||
* @type string $0 Requested capability.
|
||||
* @type int $1 Concerned user ID.
|
||||
* @type mixed ...$2 Optional second and further parameters, typically object ID.
|
||||
* }
|
||||
*
|
||||
* @return bool[]
|
||||
*/
|
||||
public function map_caps_by_role( $allcaps, $caps, $args ) {
|
||||
if ( ! isset( $caps[0], $args[0], $args[1] ) ) {
|
||||
return $allcaps;
|
||||
}
|
||||
|
||||
if ( ! in_array( $caps[0], array( 'edit_users', 'delete_users', 'list_users' ), true ) ) {
|
||||
return $allcaps;
|
||||
}
|
||||
|
||||
if ( user_can( $args[1], 'manage_options' ) ) {
|
||||
return $allcaps;
|
||||
}
|
||||
|
||||
if ( 'edit_users' === $caps[0] && 'edit_user' === $args[0] ) {
|
||||
if ( isset( $args[2] ) && ! UM()->roles()->um_current_user_can( 'edit', $args[2] ) ) {
|
||||
$allcaps[ $caps[0] ] = false;
|
||||
}
|
||||
} elseif ( 'delete_users' === $caps[0] && 'delete_user' === $args[0] ) {
|
||||
if ( isset( $args[2] ) && ! UM()->roles()->um_current_user_can( 'delete', $args[2] ) ) {
|
||||
$allcaps[ $caps[0] ] = false;
|
||||
}
|
||||
} elseif ( 'list_users' === $caps[0] ) {
|
||||
if ( 'list_users' === $args[0] && ! um_user( 'can_view_all' ) ) {
|
||||
$allcaps[ $caps[0] ] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $allcaps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide role filters with not accessible roles
|
||||
*
|
||||
* @param array $roles
|
||||
* @return array
|
||||
*/
|
||||
public function restrict_roles( $roles ) {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
return $roles;
|
||||
}
|
||||
|
||||
$can_view_roles = UM()->roles()->um_user_can( 'can_view_roles' );
|
||||
if ( UM()->roles()->um_user_can( 'can_view_all' ) && empty( $can_view_roles ) ) {
|
||||
return $roles;
|
||||
}
|
||||
|
||||
if ( ! empty( $can_view_roles ) ) {
|
||||
$wp_roles = wp_roles();
|
||||
foreach ( $wp_roles->get_names() as $this_role => $name ) {
|
||||
if ( ! in_array( $this_role, $can_view_roles, true ) ) {
|
||||
unset( $roles[ $this_role ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user statuses list.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function statuses_list() {
|
||||
$statuses = array(
|
||||
'approved' => __( 'Approved', 'ultimate-member' ),
|
||||
'awaiting_admin_review' => __( 'Pending administrator review', 'ultimate-member' ),
|
||||
'awaiting_email_confirmation' => __( 'Waiting email confirmation', 'ultimate-member' ),
|
||||
'inactive' => __( 'Membership inactive', 'ultimate-member' ),
|
||||
'rejected' => __( 'Membership rejected', 'ultimate-member' ),
|
||||
);
|
||||
/**
|
||||
* Filters the user statuses added via Ultimate Member plugin.
|
||||
*
|
||||
* Note: Statuses format is 'key' => 'title'
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_user_statuses
|
||||
*
|
||||
* @param {array} $statuses User statuses in Ultimate Member environment.
|
||||
*
|
||||
* @return {array} User statuses.
|
||||
*/
|
||||
return apply_filters( 'um_user_statuses', $statuses );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user's account status.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param string $status Status key.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function set_status( $user_id, $status ) {
|
||||
$old_status = $this->get_status( $user_id );
|
||||
|
||||
/**
|
||||
* Fires before User status is set.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_before_user_status_is_set
|
||||
*
|
||||
* @param {string} $status New status key.
|
||||
* @param {int} $user_id User ID.
|
||||
* @param {string} $old_status Old status key.
|
||||
*/
|
||||
do_action( 'um_before_user_status_is_set', $status, $user_id, $old_status );
|
||||
|
||||
$result = update_user_meta( $user_id, 'account_status', $status );
|
||||
|
||||
// false on failure or if the value passed to the function is the same as the one that is already in the database.
|
||||
if ( false !== $result ) {
|
||||
// backward compatibility. @todo maybe uncomment it after some testing.
|
||||
// UM()->user()->profile['account_status'] = $status;
|
||||
|
||||
// Reset cache.
|
||||
$this->remove_cache( $user_id );
|
||||
|
||||
/**
|
||||
* Fires just after User status is changed.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @since 2.0 Added $user_id
|
||||
* @since 2.8.7 Added $old_status
|
||||
*
|
||||
* @hook um_after_user_status_is_changed
|
||||
*
|
||||
* @param {string} $status Status key.
|
||||
* @param {int} $user_id User ID. Since 2.0
|
||||
* @param {string} $old_status Old status key. Since 2.8.7
|
||||
*/
|
||||
do_action( 'um_after_user_status_is_changed', $status, $user_id, $old_status );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user account status.
|
||||
*
|
||||
* @param int $user_id User ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_status( $user_id, $format = 'raw' ) {
|
||||
$status = get_user_meta( $user_id, 'account_status', true );
|
||||
if ( 'raw' === $format ) {
|
||||
return $status;
|
||||
}
|
||||
|
||||
$all_statuses = $this->statuses_list();
|
||||
if ( array_key_exists( $status, $all_statuses ) ) {
|
||||
return $all_statuses[ $status ];
|
||||
}
|
||||
|
||||
return __( 'Undefined', 'ultimate-member' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has selected account status.
|
||||
*
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param string $status_control Status key.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has_status( $user_id, $status_control ) {
|
||||
$status = $this->get_status( $user_id );
|
||||
return $status === $status_control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset User cache
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
*/
|
||||
public function remove_cache( $user_id ) {
|
||||
delete_option( "um_cache_userdata_{$user_id}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Activation link hash.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
*/
|
||||
public function reset_activation_link( $user_id ) {
|
||||
delete_user_meta( $user_id, 'account_secret_hash' );
|
||||
delete_user_meta( $user_id, 'account_secret_hash_expiry' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user's activation link hash
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
*/
|
||||
public function assign_secretkey( $user_id ) {
|
||||
if ( ! $this->has_status( $user_id, 'awaiting_email_confirmation' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before user activation link hash is generated.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @since 2.8.7 Added $user_id
|
||||
* @hook um_before_user_hash_is_changed
|
||||
*
|
||||
* @param {int} $user_id User ID. Since 2.8.7
|
||||
*/
|
||||
do_action( 'um_before_user_hash_is_changed', $user_id );
|
||||
|
||||
$hash = UM()->validation()->generate();
|
||||
update_user_meta( $user_id, 'account_secret_hash', $hash );
|
||||
// backward compatibility. @todo maybe uncomment it after some testing.
|
||||
// UM()->user()->profile['account_secret_hash'] = $hash;
|
||||
|
||||
$expiration = '';
|
||||
$expiry_time = UM()->options()->get( 'activation_link_expiry_time' );
|
||||
if ( ! empty( $expiry_time ) && is_numeric( $expiry_time ) ) {
|
||||
$expiration = time() + $expiry_time * DAY_IN_SECONDS;
|
||||
update_user_meta( $user_id, 'account_secret_hash_expiry', $expiration );
|
||||
// backward compatibility. @todo maybe uncomment it after some testing.
|
||||
// UM()->user()->profile['account_secret_hash_expiry'] = $expiration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after user activation link hash is changed.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @since 2.8.7 Added $user_id, $hash, $expiration
|
||||
* @hook um_before_user_hash_is_changed
|
||||
*
|
||||
* @param {int} $user_id User ID. Since 2.8.7.
|
||||
* @param {string} $hash Activation link hash. Since 2.8.7.
|
||||
* @param {int} $expiration Expiration timestamp. Since 2.8.7.
|
||||
*/
|
||||
do_action( 'um_after_user_hash_is_changed', $user_id, $hash, $expiration );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WP_User $userdata
|
||||
*
|
||||
* @return string|WP_Error
|
||||
*/
|
||||
public function maybe_generate_password_reset_key( $userdata ) {
|
||||
return get_password_reset_key( $userdata );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_current_user_edit_user( $user_id ) {
|
||||
$current_user_id = get_current_user_id();
|
||||
if ( $current_user_id === $user_id ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ! self::user_exists( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$rolename = UM()->roles()->get_priority_user_role( $current_user_id );
|
||||
$role = get_role( $rolename );
|
||||
|
||||
if ( null === $role ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make Ultimate Member bulk actions only when the current user has 'edit_users' capability.
|
||||
if ( ! current_user_can( 'edit_users' ) && ! $role->has_cap( 'edit_users' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_activation_send( $user_id, $force = false ) {
|
||||
if ( ! $force ) {
|
||||
$current_user_id = get_current_user_id();
|
||||
if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*if ( ! $this->can_current_user_edit_user( $user_id ) ) {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
$status = $this->get_status( $user_id );
|
||||
return 'awaiting_admin_review' !== $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function send_activation( $user_id, $force = false ) {
|
||||
if ( ! $this->can_activation_send( $user_id, $force ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before User has been set as pending email confirmation.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_before_user_is_set_as_awaiting_email_confirmation
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_before_user_is_set_as_awaiting_email_confirmation', $user_id );
|
||||
|
||||
$result = $this->set_status( $user_id, 'awaiting_email_confirmation' );
|
||||
|
||||
// It's `false` on failure or if the user already has rejected status.
|
||||
if ( false !== $result ) {
|
||||
// Clear all sessions for email confirmation pending users
|
||||
self::destroy_all_sessions( $user_id );
|
||||
|
||||
// Set activation link hash.
|
||||
$this->assign_secretkey( $user_id );
|
||||
|
||||
$userdata = get_userdata( $user_id );
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->user(), 'add_activation_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->user(), 'add_activation_replace_placeholder' ) );
|
||||
|
||||
UM()->mail()->send( $userdata->user_email, 'checkmail_email' );
|
||||
|
||||
/**
|
||||
* Fires after User has been set as pending email confirmation.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_after_user_is_set_as_awaiting_email_confirmation
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_after_user_is_set_as_awaiting_email_confirmation', $user_id );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_be_deactivated( $user_id, $force = false ) {
|
||||
if ( ! $force ) {
|
||||
$current_user_id = get_current_user_id();
|
||||
if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*if ( ! $this->can_current_user_edit_user( $user_id ) ) {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
$status = $this->get_status( $user_id );
|
||||
if ( 'inactive' === $status ) {
|
||||
// Break if the user already approved
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'approved' !== $status ) {
|
||||
// Break if the user already doesn't approved yet
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deactivate( $user_id, $force = false ) {
|
||||
if ( ! $this->can_be_deactivated( $user_id, $force ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before User has been deactivated.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_before_user_is_deactivated
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_before_user_is_deactivated', $user_id );
|
||||
|
||||
$result = $this->set_status( $user_id, 'inactive' );
|
||||
|
||||
// It's `false` on failure or if the user already has approved status.
|
||||
if ( false !== $result ) {
|
||||
// Clear all sessions for inactive users
|
||||
self::destroy_all_sessions( $user_id );
|
||||
|
||||
$userdata = get_userdata( $user_id );
|
||||
UM()->mail()->send( $userdata->user_email, 'inactive_email' );
|
||||
|
||||
/**
|
||||
* Fires after User has been deactivated.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_after_user_is_inactive
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_after_user_is_inactive', $user_id );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_be_rejected( $user_id, $force = false ) {
|
||||
if ( ! $force ) {
|
||||
$current_user_id = get_current_user_id();
|
||||
if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*if ( ! $this->can_current_user_edit_user( $user_id ) ) {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
$status = $this->get_status( $user_id );
|
||||
if ( 'rejected' === $status ) {
|
||||
// Break if the user already rejected
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'approved' !== $status ) {
|
||||
// Break if the user already doesn't approved yet
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject user membership.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reject( $user_id, $force = false ) {
|
||||
if ( ! $this->can_be_rejected( $user_id, $force ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before User has been rejected.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_before_user_is_rejected
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_before_user_is_rejected', $user_id );
|
||||
|
||||
$result = $this->set_status( $user_id, 'rejected' );
|
||||
|
||||
// It's `false` on failure or if the user already has rejected status.
|
||||
if ( false !== $result ) {
|
||||
// Clear all sessions for rejected users
|
||||
self::destroy_all_sessions( $user_id );
|
||||
|
||||
$userdata = get_userdata( $user_id );
|
||||
UM()->mail()->send( $userdata->user_email, 'rejected_email' );
|
||||
|
||||
/**
|
||||
* Fires after User has been rejected.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_after_user_is_rejected
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_after_user_is_rejected', $user_id );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user can be set as pending admin review.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_be_set_as_pending( $user_id, $force = false ) {
|
||||
if ( ! $force ) {
|
||||
$current_user_id = get_current_user_id();
|
||||
if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*if ( ! $this->can_current_user_edit_user( $user_id ) ) {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
$status = $this->get_status( $user_id );
|
||||
return 'awaiting_admin_review' !== $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user as pending admin review.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function set_as_pending( $user_id, $force = false ) {
|
||||
if ( ! $this->can_be_set_as_pending( $user_id, $force ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before User has been set as pending admin review.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_before_user_is_set_as_pending
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_before_user_is_set_as_pending', $user_id );
|
||||
|
||||
$result = $this->set_status( $user_id, 'awaiting_admin_review' );
|
||||
|
||||
// It's `false` on failure or if the user already has rejected status.
|
||||
if ( false !== $result ) {
|
||||
// Clear all sessions for awaiting admin confirmation users
|
||||
self::destroy_all_sessions( $user_id );
|
||||
|
||||
$userdata = get_userdata( $user_id );
|
||||
UM()->mail()->send( $userdata->user_email, 'pending_email' );
|
||||
|
||||
/**
|
||||
* Fires after User has been set as pending admin review.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_after_user_is_set_as_pending
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_after_user_is_set_as_pending', $user_id );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user can be approved.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_be_approved( $user_id, $force = false ) {
|
||||
if ( ! $force ) {
|
||||
$current_user_id = get_current_user_id();
|
||||
if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*if ( ! $this->can_current_user_edit_user( $user_id ) ) {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
$status = $this->get_status( $user_id );
|
||||
return 'approved' !== $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve user.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool `true` if the user has been approved
|
||||
* `false` on failure or if the user already has approved status.
|
||||
*/
|
||||
public function approve( $user_id, $force = false ) {
|
||||
if ( ! $this->can_be_approved( $user_id, $force ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before User has been approved.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_before_user_is_approved
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_before_user_is_approved', $user_id );
|
||||
|
||||
$old_status = $this->get_status( $user_id );
|
||||
|
||||
$result = $this->set_status( $user_id, 'approved' );
|
||||
|
||||
// It's `false` on failure or if the user already has approved status.
|
||||
if ( false !== $result ) {
|
||||
$userdata = get_userdata( $user_id );
|
||||
|
||||
$this->reset_activation_link( $user_id );
|
||||
|
||||
$email_slug = 'welcome_email';
|
||||
if ( 'awaiting_admin_review' === $old_status ) {
|
||||
$email_slug = 'approved_email';
|
||||
$this->maybe_generate_password_reset_key( $userdata );
|
||||
}
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ) );
|
||||
|
||||
UM()->mail()->send( $userdata->user_email, $email_slug );
|
||||
|
||||
/**
|
||||
* Fires after User has been approved.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_after_user_is_approved
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_after_user_is_approved', $user_id );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_be_reactivated( $user_id, $force = false ) {
|
||||
if ( ! $force ) {
|
||||
$current_user_id = get_current_user_id();
|
||||
if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*if ( ! $this->can_current_user_edit_user( $user_id ) ) {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
$status = $this->get_status( $user_id );
|
||||
return 'inactive' === $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reactivate user.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param bool $force If true - ignore current user condition.
|
||||
*
|
||||
* @return bool `true` if the user has been reactivated
|
||||
* `false` on failure or if the user already has approved status.
|
||||
*/
|
||||
public function reactivate( $user_id, $force = false ) {
|
||||
if ( ! $this->can_be_reactivated( $user_id, $force ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before User has been reactivated.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_before_user_is_reactivated
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_before_user_is_reactivated', $user_id );
|
||||
|
||||
$result = $this->set_status( $user_id, 'approved' );
|
||||
|
||||
// It's `false` on failure or if the user already has approved status.
|
||||
if ( false !== $result ) {
|
||||
// Reset activation link hash.
|
||||
$this->reset_activation_link( $user_id );
|
||||
|
||||
$userdata = get_userdata( $user_id );
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ) );
|
||||
|
||||
UM()->mail()->send( $userdata->user_email, 'welcome_email' );
|
||||
|
||||
/**
|
||||
* Fires after User has been reactivated.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_after_user_is_reactivated
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
do_action( 'um_after_user_is_reactivated', $user_id );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function user_exists( $user_id ) {
|
||||
/**
|
||||
* @var bool[] $search_results
|
||||
*/
|
||||
static $search_results = array();
|
||||
|
||||
if ( array_key_exists( $user_id, $search_results ) ) {
|
||||
return $search_results[ $user_id ];
|
||||
}
|
||||
|
||||
$user = get_userdata( $user_id );
|
||||
|
||||
$search_results[ $user_id ] = false !== $user;
|
||||
return $search_results[ $user_id ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all sessions for user ID.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function destroy_all_sessions( $user_id ) {
|
||||
$user = WP_Session_Tokens::get_instance( $user_id );
|
||||
$user->destroy_all();
|
||||
}
|
||||
}
|
||||
@@ -761,6 +761,8 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$original_post_content = $content;
|
||||
|
||||
if ( $this->is_restricted( $id ) ) {
|
||||
$restriction = $this->get_post_privacy_settings( $id );
|
||||
|
||||
@@ -770,8 +772,31 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
$content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
}
|
||||
|
||||
// translators: %s: Restricted post message.
|
||||
$content = sprintf( __( '%s', 'ultimate-member' ), $content );
|
||||
// Because we have a late the_content callback priority here we have to apply shortcodes if faced in restricted message.
|
||||
$content = apply_shortcodes( $content );
|
||||
/**
|
||||
* Filters the restricted post content.
|
||||
* Can be used for translations when site is multilingual.
|
||||
*
|
||||
* @param {string} $content Post content prepared from restricted message.
|
||||
* @param {int} $post_id Post ID
|
||||
* @param {string} $original_post_content Original post content.
|
||||
*
|
||||
* @return {string} Maybe changed post content prepared from restricted message.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_restricted_post_content
|
||||
*
|
||||
* @example <caption>Trim restriction message if post_id = 111.</caption>
|
||||
* function my_restricted_post_content( $content, $post_id, $original_post_content ) {
|
||||
* if ( 111 === $post_id ) {
|
||||
* $content = trim( $content );
|
||||
* }
|
||||
* return $content;
|
||||
* }
|
||||
* add_filter( 'um_restricted_post_content', 'my_restricted_post_content', 10, 3 );
|
||||
*/
|
||||
$content = apply_filters( 'um_restricted_post_content', $content, $id, $original_post_content );
|
||||
}
|
||||
|
||||
return $content;
|
||||
@@ -1239,7 +1264,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$default_message = UM()->options()->get( 'restricted_block_message' );
|
||||
$default_message = wp_kses_post( UM()->options()->get( 'restricted_block_message' ) );
|
||||
switch ( $block['attrs']['um_who_access'] ) {
|
||||
case '1': {
|
||||
if ( ! is_user_logged_in() ) {
|
||||
|
||||
@@ -1074,6 +1074,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'icon' => 'fab fa-telegram',
|
||||
'validate' => 'telegram_url',
|
||||
'url_text' => 'Telegram',
|
||||
'advanced' => 'social',
|
||||
'color' => '#24A1DE',
|
||||
'match' => 'https://t.me/',
|
||||
),
|
||||
|
||||
@@ -1090,7 +1092,9 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'url_text' => __( 'Discord', 'ultimate-member' ),
|
||||
'url_rel' => 'nofollow',
|
||||
'validate' => 'discord',
|
||||
'advanced' => 'social',
|
||||
'color' => '#7289da',
|
||||
'match' => 'https://discord.com/users/',
|
||||
),
|
||||
|
||||
'tiktok' => array(
|
||||
|
||||
@@ -1513,24 +1513,24 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get field label
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $key Field meta key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_label( $key ) {
|
||||
$label = '';
|
||||
public function get_label( $key ) {
|
||||
$label = '';
|
||||
$fields = UM()->builtin()->all_user_fields;
|
||||
$field_data = array_key_exists( $key, $fields ) ? $fields[ $key ] : array();
|
||||
|
||||
$fields = UM()->builtin()->all_user_fields;
|
||||
if ( isset( $fields[ $key ]['label'] ) ) {
|
||||
$label = stripslashes( $fields[ $key ]['label'] );
|
||||
if ( array_key_exists( 'label', $field_data ) ) {
|
||||
$label = stripslashes( $field_data['label'] );
|
||||
}
|
||||
|
||||
if ( empty( $label ) && isset( $fields[ $key ]['title'] ) ) {
|
||||
$label = stripslashes( $fields[ $key ]['title'] );
|
||||
if ( empty( $label ) && array_key_exists( 'title', $field_data ) ) {
|
||||
$label = stripslashes( $field_data['title'] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1556,13 +1556,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* }
|
||||
* add_filter( 'um_change_field_label', 'my_change_field_label', 10, 3 );
|
||||
*/
|
||||
$label = apply_filters( 'um_change_field_label', $label, $key, $fields[ $key ] );
|
||||
$label = apply_filters( 'um_change_field_label', $label, $key, $field_data );
|
||||
|
||||
$label = sprintf( __( '%s', 'ultimate-member' ), $label );
|
||||
return $label;
|
||||
return sprintf( __( '%s', 'ultimate-member' ), $label );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get field title
|
||||
*
|
||||
@@ -2112,7 +2110,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
return apply_filters( 'um_field_non_utf8_value', $option_value );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getting the fields that need to be disabled in edit mode (profile)
|
||||
*
|
||||
@@ -2830,6 +2827,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
*/
|
||||
$textarea_settings = apply_filters( 'um_form_fields_textarea_settings', $textarea_settings, $data );
|
||||
|
||||
$field_value = empty( $field_value ) ? '' : $field_value;
|
||||
|
||||
// turn on the output buffer
|
||||
ob_start();
|
||||
|
||||
@@ -4299,6 +4298,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$data = $this->get_field( $key );
|
||||
}
|
||||
|
||||
// Invalid field data.
|
||||
if ( ! is_array( $data ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
//hide if empty type
|
||||
if ( ! array_key_exists( 'type', $data ) || empty( $data['type'] ) ) {
|
||||
return '';
|
||||
|
||||
@@ -1244,29 +1244,20 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
return $removed_files;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Format Bytes
|
||||
*
|
||||
* @deprecated 2.8.7
|
||||
* @param $size
|
||||
* @param int $precision
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function format_bytes( $size, $precision = 1 ) {
|
||||
if ( is_numeric( $size ) ) {
|
||||
$base = log( $size, 1024 );
|
||||
$suffixes = array( '', 'kb', 'MB', 'GB', 'TB' );
|
||||
$computed_size = round( pow( 1024, $base - floor( $base ) ), $precision );
|
||||
$unit = $suffixes[ floor( $base ) ];
|
||||
|
||||
return $computed_size.' '.$unit;
|
||||
}
|
||||
|
||||
return '';
|
||||
public function format_bytes( $size, $precision = 1 ) {
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->filesystem()->format_bytes()' );
|
||||
return UM()->common()->filesystem()::format_bytes( $size, $precision );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of profile/cover sizes
|
||||
*
|
||||
|
||||
@@ -448,6 +448,11 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
|
||||
$ignore_keys = array();
|
||||
|
||||
$arr_restricted_fields = array();
|
||||
if ( 'profile' === $this->form_data['mode'] ) {
|
||||
$arr_restricted_fields = UM()->fields()->get_restricted_fields_for_edit();
|
||||
}
|
||||
|
||||
$field_types_without_metakey = UM()->builtin()->get_fields_without_metakey();
|
||||
foreach ( $custom_fields as $cf_k => $cf_data ) {
|
||||
if ( ! array_key_exists( 'type', $cf_data ) || in_array( $cf_data['type'], $field_types_without_metakey, true ) ) {
|
||||
@@ -493,7 +498,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
// Column names from wp_users table.
|
||||
$cf_metakeys = array_values( array_diff( $cf_metakeys, array( 'user_login' ) ) );
|
||||
// Hidden for edit fields
|
||||
$cf_metakeys = array_values( array_diff( $cf_metakeys, UM()->fields()->get_restricted_fields_for_edit() ) );
|
||||
$cf_metakeys = array_values( array_diff( $cf_metakeys, $arr_restricted_fields ) );
|
||||
|
||||
$cf_metakeys[] = 'profile_photo';
|
||||
$cf_metakeys[] = 'cover_photo';
|
||||
@@ -758,6 +763,12 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
break;
|
||||
case 'textarea':
|
||||
if ( ! empty( $field['html'] ) || ( UM()->profile()->get_show_bio_key( $form ) === $k && UM()->options()->get( 'profile_show_html_bio' ) ) ) {
|
||||
$form[ $k ] = html_entity_decode( $form[ $k ] ); // required because WP_Editor send sometimes encoded content.
|
||||
preg_match( '/^<p>(.*?)<\/p>$/', $form[ $k ], $match ); // required because WP_Editor send content wrapped to <p></p>
|
||||
if ( ! empty( $match[1] ) ) {
|
||||
$form[ $k ] = $match[1];
|
||||
}
|
||||
|
||||
$allowed_html = UM()->get_allowed_html( 'templates' );
|
||||
if ( empty( $allowed_html['iframe'] ) ) {
|
||||
$allowed_html['iframe'] = array(
|
||||
@@ -856,6 +867,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
case 'vimeo_video':
|
||||
case 'soundcloud_track':
|
||||
case 'spotify':
|
||||
case 'tel':
|
||||
$form[ $k ] = sanitize_text_field( $form[ $k ] );
|
||||
break;
|
||||
case 'multiselect':
|
||||
|
||||
@@ -2589,21 +2589,18 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
return $pagination_data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function build_user_actions_list( $user_id ) {
|
||||
|
||||
private function build_user_actions_list( $user_id ) {
|
||||
$actions = array();
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return $actions;
|
||||
}
|
||||
|
||||
if ( get_current_user_id() != $user_id ) {
|
||||
|
||||
if ( get_current_user_id() !== $user_id ) {
|
||||
if ( UM()->roles()->um_current_user_can( 'edit', $user_id ) ) {
|
||||
$actions['um-editprofile'] = array(
|
||||
'title' => esc_html__( 'Edit Profile', 'ultimate-member' ),
|
||||
@@ -2611,31 +2608,17 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_user_actions_hook
|
||||
* @description Extend admin actions for each user
|
||||
* @input_vars
|
||||
* [{"var":"$actions","type":"array","desc":"Actions for user"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_admin_user_actions_hook', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_user_actions_hook', 'my_admin_user_actions', 10, 1 );
|
||||
* function my_admin_user_actions( $actions ) {
|
||||
* // your code here
|
||||
* return $actions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$admin_actions = apply_filters( 'um_admin_user_actions_hook', array(), $user_id );
|
||||
$admin_actions = UM()->frontend()->users()->get_actions_list( $user_id );
|
||||
if ( ! empty( $admin_actions ) ) {
|
||||
foreach ( $admin_actions as $id => $arr ) {
|
||||
$url = add_query_arg( array( 'um_action' => $id, 'uid' => $user_id ), um_get_core_page( 'user' ) );
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um_action' => $id,
|
||||
'uid' => $user_id,
|
||||
'nonce' => wp_create_nonce( $id . $user_id ),
|
||||
),
|
||||
um_user_profile_url( $user_id )
|
||||
);
|
||||
|
||||
$actions[ $id ] = array(
|
||||
'title' => esc_html( $arr['label'] ),
|
||||
@@ -2645,9 +2628,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
}
|
||||
|
||||
$actions = apply_filters( 'um_member_directory_users_card_actions', $actions, $user_id );
|
||||
|
||||
} else {
|
||||
|
||||
if ( empty( UM()->user()->cannot_edit ) ) {
|
||||
$actions['um-editprofile'] = array(
|
||||
'title' => esc_html__( 'Edit Profile', 'ultimate-member' ),
|
||||
@@ -2671,15 +2652,13 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
return $actions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $user_id
|
||||
* @param array $directory_data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function build_user_card_data( $user_id, $directory_data ) {
|
||||
|
||||
public function build_user_card_data( $user_id, $directory_data ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
$dropdown_actions = $this->build_user_actions_list( $user_id );
|
||||
|
||||
@@ -117,25 +117,25 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
||||
|
||||
$account_secret_hash = get_user_meta( $user_id, 'account_secret_hash', true );
|
||||
if ( empty( $account_secret_hash ) || strtolower( sanitize_text_field( $_REQUEST['hash'] ) ) !== strtolower( $account_secret_hash ) ) {
|
||||
wp_die( __( 'This activation link is expired or have already been used.', 'ultimate-member' ) );
|
||||
wp_die( esc_html__( 'This activation link is expired or have already been used.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$account_secret_hash_expiry = get_user_meta( $user_id, 'account_secret_hash_expiry', true );
|
||||
if ( ! empty( $account_secret_hash_expiry ) && time() > $account_secret_hash_expiry ) {
|
||||
wp_die( __( 'This activation link is expired.', 'ultimate-member' ) );
|
||||
wp_die( esc_html__( 'This activation link is expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$redirect = um_get_core_page( 'login', 'account_active' );
|
||||
$set_password_required = get_user_meta( $user_id, 'um_set_password_required', true );
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
UM()->user()->approve();
|
||||
UM()->common()->users()->approve( $user_id, true );
|
||||
if ( ! empty( $set_password_required ) ) {
|
||||
$redirect = um_user( 'password_reset_link' );
|
||||
}
|
||||
um_reset_user();
|
||||
|
||||
$user_role = UM()->roles()->get_priority_user_role( $user_id );
|
||||
$user_role = UM()->roles()->get_priority_user_role( $user_id );
|
||||
$user_role_data = UM()->roles()->role_data( $user_role );
|
||||
|
||||
// log in automatically
|
||||
|
||||
@@ -307,17 +307,24 @@ if ( ! class_exists( 'um\core\Query' ) ) {
|
||||
return $users_count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count all users
|
||||
*
|
||||
* @return mixed
|
||||
* @param bool $force Avoid transient. Default false.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function count_users() {
|
||||
$result = count_users();
|
||||
return $result['total_users'];
|
||||
}
|
||||
public function count_users( $force = false ) {
|
||||
$users_count = get_transient( 'um_count_users_all' );
|
||||
if ( $force || false === $users_count ) {
|
||||
$result = count_users();
|
||||
|
||||
$users_count = $result['total_users'];
|
||||
set_transient( 'um_count_users_all', $users_count, HOUR_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $users_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Using wpdb instead of update_post_meta
|
||||
|
||||
@@ -234,8 +234,8 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
$user_id = $this->get_user_id_by_user_login_slug();
|
||||
}
|
||||
|
||||
if ( 'user_id' === $permalink_base ) {
|
||||
$user_id = UM()->user()->user_exists_by_id( um_queried_user() );
|
||||
if ( 'user_id' === $permalink_base && UM()->common()->users()::user_exists( um_queried_user() ) ) {
|
||||
$user_id = um_queried_user();
|
||||
}
|
||||
|
||||
if ( 'hash' === $permalink_base ) {
|
||||
|
||||
@@ -392,21 +392,18 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
return $classes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logged-in only content
|
||||
*
|
||||
* @param array $args
|
||||
* @param array $args
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function um_loggedin( $args = array(), $content = "" ) {
|
||||
ob_start();
|
||||
|
||||
public function um_loggedin( $args = array(), $content = '' ) {
|
||||
$args = shortcode_atts(
|
||||
array(
|
||||
'lock_text' => __( 'This content has been restricted to logged in users only. Please <a href="{login_referrer}">login</a> to view this content.', 'ultimate-member' ),
|
||||
'lock_text' => __( 'This content has been restricted to logged-in users only. Please <a href="{login_referrer}">login</a> to view this content.', 'ultimate-member' ),
|
||||
'show_lock' => 'yes',
|
||||
),
|
||||
$args,
|
||||
@@ -414,50 +411,52 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
);
|
||||
|
||||
if ( ! is_user_logged_in() ) {
|
||||
// Hide content for not logged-in users. Maybe display locked content notice.
|
||||
if ( 'no' === $args['show_lock'] ) {
|
||||
echo '';
|
||||
} else {
|
||||
$args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] );
|
||||
UM()->get_template( 'login-to-view.php', '', $args, true );
|
||||
}
|
||||
} else {
|
||||
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
|
||||
echo do_shortcode( $this->convert_locker_tags( wpautop( $content ) ) );
|
||||
} else {
|
||||
echo apply_shortcodes( $this->convert_locker_tags( wpautop( $content ) ) );
|
||||
return '';
|
||||
}
|
||||
|
||||
$args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] );
|
||||
return UM()->get_template( 'login-to-view.php', '', $args );
|
||||
}
|
||||
|
||||
$output = ob_get_clean();
|
||||
$prepared_content = wp_kses( apply_shortcodes( $this->convert_locker_tags( wpautop( $content ) ) ), UM()->get_allowed_html( 'templates' ) );
|
||||
|
||||
return htmlspecialchars_decode( $output, ENT_NOQUOTES );
|
||||
/**
|
||||
* Filters prepared inner content via Ultimate Member handlers in [um_loggedin] shortcode.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_loggedin_inner_content
|
||||
*
|
||||
* @param {string} $prepared_content Prepared inner content via Ultimate Member handlers.
|
||||
* @param {string} $content Original inner content.
|
||||
*
|
||||
* @return {string} Prepared inner content.
|
||||
*
|
||||
* @example <caption>Change inner content with own handlers.</caption>
|
||||
* function my_um_loggedin_inner_content( $prepared_content, $content ) {
|
||||
* $prepared_content = esc_html( $content );
|
||||
* return $prepared_content;
|
||||
* }
|
||||
* add_filter( 'um_loggedin_inner_content', 'my_um_loggedin_inner_content', 10, 2 );
|
||||
*/
|
||||
return apply_filters( 'um_loggedin_inner_content', $prepared_content, $content );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logged-out only content
|
||||
*
|
||||
* @param array $args
|
||||
* @param array $args
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function um_loggedout( $args = array(), $content = '' ) {
|
||||
ob_start();
|
||||
|
||||
// Hide for logged in users
|
||||
public function um_loggedout( $args = array(), $content = '' ) {
|
||||
if ( is_user_logged_in() ) {
|
||||
echo '';
|
||||
} else {
|
||||
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
|
||||
echo do_shortcode( wpautop( $content ) );
|
||||
} else {
|
||||
echo apply_shortcodes( wpautop( $content ) );
|
||||
}
|
||||
// Hide for logged-in users
|
||||
return '';
|
||||
}
|
||||
|
||||
$output = ob_get_clean();
|
||||
return $output;
|
||||
return apply_shortcodes( $this->convert_locker_tags( wpautop( $content ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -673,6 +672,22 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
$args['form_id'] = ! empty( $args['form_id'] ) ? absint( $args['form_id'] ) : '';
|
||||
$args['is_block'] = (bool) $args['is_block'];
|
||||
|
||||
$form_post = get_post( $args['form_id'] );
|
||||
// Invalid post ID. Maybe post doesn't exist.
|
||||
if ( empty( $form_post ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Invalid post type. It can be only `um_form` or `um_directory`
|
||||
$post_types = array( 'um_form' );
|
||||
if ( UM()->options()->get( 'members_page' ) ) {
|
||||
$post_types[] = 'um_directory';
|
||||
}
|
||||
|
||||
if ( ! in_array( $form_post->post_type, $post_types, true ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters variable for enable singleton shortcode loading on the same page.
|
||||
* Note: Set it to `false` if you don't need to render the same form twice or more on the same page.
|
||||
@@ -1192,9 +1207,9 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
function convert_locker_tags( $str ) {
|
||||
add_filter( 'um_template_tags_patterns_hook', array( &$this, 'add_placeholder' ), 10, 1 );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( &$this, 'add_replace_placeholder' ), 10, 1 );
|
||||
public function convert_locker_tags( $str ) {
|
||||
add_filter( 'um_template_tags_patterns_hook', array( &$this, 'add_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( &$this, 'add_replace_placeholder' ) );
|
||||
return um_convert_tags( $str, array(), false );
|
||||
}
|
||||
|
||||
@@ -1319,18 +1334,22 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
function um_shortcode_show_content_for_role( $atts = array() , $content = '' ) {
|
||||
public function um_shortcode_show_content_for_role( $atts = array(), $content = '' ) {
|
||||
global $user_ID;
|
||||
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
$a = shortcode_atts( array(
|
||||
'roles' => '',
|
||||
'not' => '',
|
||||
'is_profile' => false,
|
||||
), $atts );
|
||||
$a = shortcode_atts(
|
||||
array(
|
||||
'roles' => '',
|
||||
'not' => '',
|
||||
'is_profile' => false,
|
||||
),
|
||||
$atts,
|
||||
'um_show_content'
|
||||
);
|
||||
|
||||
if ( $a['is_profile'] ) {
|
||||
um_fetch_user( um_profile_id() );
|
||||
@@ -1341,39 +1360,26 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
$current_user_roles = um_user( 'roles' );
|
||||
|
||||
if ( ! empty( $a['not'] ) && ! empty( $a['roles'] ) ) {
|
||||
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
|
||||
return do_shortcode( $this->convert_locker_tags( $content ) );
|
||||
} else {
|
||||
return apply_shortcodes( $this->convert_locker_tags( $content ) );
|
||||
}
|
||||
return apply_shortcodes( $this->convert_locker_tags( $content ) );
|
||||
}
|
||||
|
||||
if ( ! empty( $a['not'] ) ) {
|
||||
$not_in_roles = explode( ",", $a['not'] );
|
||||
$not_in_roles = explode( ',', $a['not'] );
|
||||
|
||||
if ( is_array( $not_in_roles ) && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, $not_in_roles ) ) <= 0 ) ) {
|
||||
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
|
||||
return do_shortcode( $this->convert_locker_tags( $content ) );
|
||||
} else {
|
||||
return apply_shortcodes( $this->convert_locker_tags( $content ) );
|
||||
}
|
||||
return apply_shortcodes( $this->convert_locker_tags( $content ) );
|
||||
}
|
||||
} else {
|
||||
$roles = explode( ",", $a['roles'] );
|
||||
$roles = explode( ',', $a['roles'] );
|
||||
|
||||
if ( ! empty( $current_user_roles ) && is_array( $roles ) && count( array_intersect( $current_user_roles, $roles ) ) > 0 ) {
|
||||
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
|
||||
return do_shortcode( $this->convert_locker_tags( $content ) );
|
||||
} else {
|
||||
return apply_shortcodes( $this->convert_locker_tags( $content ) );
|
||||
}
|
||||
return apply_shortcodes( $this->convert_locker_tags( $content ) );
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @param string $content
|
||||
@@ -1426,36 +1432,36 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
|
||||
$search_value = array_values( $query );
|
||||
|
||||
$template = UM()->get_template( 'searchform.php', '', array( 'query' => $query, 'search_value' => $search_value[0], 'members_page' => um_get_core_page( 'members' ) ) );
|
||||
|
||||
return $template;
|
||||
$t_args = array(
|
||||
'query' => $query,
|
||||
'search_value' => $search_value[0],
|
||||
'members_page' => um_get_core_page( 'members' ),
|
||||
);
|
||||
return UM()->get_template( 'searchform.php', '', $t_args );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM Placeholders for login referrer
|
||||
*
|
||||
* @param $placeholders
|
||||
* @param array $placeholders
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function add_placeholder( $placeholders ) {
|
||||
public function add_placeholder( $placeholders ) {
|
||||
$placeholders[] = '{login_referrer}';
|
||||
return $placeholders;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM Replace Placeholders for login referrer
|
||||
*
|
||||
* @param $replace_placeholders
|
||||
* @param array $replace_placeholders
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function add_replace_placeholder( $replace_placeholders ) {
|
||||
public function add_replace_placeholder( $replace_placeholders ) {
|
||||
$replace_placeholders[] = um_dynamic_login_page_redirect();
|
||||
return $replace_placeholders;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+42
-348
@@ -130,7 +130,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
add_action( 'personal_options_update', array( &$this, 'remove_cache' ) );
|
||||
//add_action('edit_user_profile_update', array(&$this, 'remove_cache') );
|
||||
add_action( 'um_when_role_is_set', array( &$this, 'remove_cache' ) );
|
||||
add_action( 'um_when_status_is_set', array( &$this, 'remove_cache' ) );
|
||||
|
||||
add_action( 'show_user_profile', array( $this, 'profile_form_additional_section' ), 10 );
|
||||
add_action( 'user_new_form', array( $this, 'profile_form_additional_section' ), 10 );
|
||||
@@ -1504,134 +1503,25 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
/**
|
||||
* Set user's account status
|
||||
*
|
||||
* @param $status
|
||||
* @deprecated 2.8.7
|
||||
*
|
||||
* @param string $status
|
||||
*/
|
||||
function set_status( $status ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_when_status_is_set
|
||||
* @description Action on user status changed
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_when_status_is_set', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_when_status_is_set', 'my_when_status_is_set', 10, 1 );
|
||||
* function my_when_status_is_set( $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_when_status_is_set', um_user( 'ID' ) );
|
||||
|
||||
$this->profile['account_status'] = $status;
|
||||
|
||||
$this->update_usermeta_info( 'account_status' );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_after_user_status_is_changed_hook
|
||||
* @description Action after user status changed
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_after_user_status_is_changed_hook', 'function_name', 10 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_after_user_status_is_changed_hook', 'my_after_user_status_is_changed', 10 );
|
||||
* function my_after_user_status_is_changed() {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_user_status_is_changed_hook', um_user( 'ID' ) );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_after_user_status_is_changed
|
||||
* @description Action after user status changed
|
||||
* @input_vars
|
||||
* [{"var":"$status","type":"string","desc":"User Status"},
|
||||
* {"var":"$user_id","type":"integer","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_after_user_status_is_changed', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_after_user_status_is_changed', 'my_after_user_status_is_changed', 10, 1 );
|
||||
* function my_after_user_status_is_changed( $status ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_user_status_is_changed', $status, um_user( 'ID' ) );
|
||||
|
||||
public function set_status( $status ) {
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->set_status()' );
|
||||
UM()->common()->users()->set_status( $status, um_user( 'ID' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set user's hash
|
||||
*
|
||||
* @deprecated 2.8.7
|
||||
*/
|
||||
function assign_secretkey() {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_before_user_hash_is_changed
|
||||
* @description Action before user hash is changed
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_before_user_hash_is_changed', 'function_name', 10 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_before_user_hash_is_changed', 'my_before_user_hash_is_changed', 10 );
|
||||
* function my_before_user_hash_is_changed() {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_before_user_hash_is_changed' );
|
||||
|
||||
$this->profile['account_secret_hash'] = UM()->validation()->generate();
|
||||
$this->update_usermeta_info( 'account_secret_hash' );
|
||||
|
||||
$expiry_time = UM()->options()->get( 'activation_link_expiry_time' );
|
||||
if ( ! empty( $expiry_time ) && is_numeric( $expiry_time ) ) {
|
||||
$this->profile['account_secret_hash_expiry'] = time() + $expiry_time * DAY_IN_SECONDS;
|
||||
$this->update_usermeta_info( 'account_secret_hash_expiry' );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_after_user_hash_is_changed
|
||||
* @description Action after user hash is changed
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_after_user_hash_is_changed', 'function_name', 10 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_after_user_hash_is_changed', 'my_after_user_hash_is_changed', 10 );
|
||||
* function my_after_user_hash_is_changed() {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_user_hash_is_changed' );
|
||||
public function assign_secretkey() {
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->assign_secretkey()' );
|
||||
UM()->common()->users()->assign_secretkey( um_user( 'ID' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \WP_User $userdata
|
||||
*
|
||||
@@ -1677,186 +1567,53 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
/**
|
||||
* This method approves a user membership and sends them an optional welcome/approval email.
|
||||
*
|
||||
* @usage <?php UM()->user()->approve(); ?>
|
||||
*
|
||||
* @example Approve a pending user and allow him to sign-in to your site.
|
||||
|
||||
<?php
|
||||
|
||||
um_fetch_user( 352 );
|
||||
UM()->user()->approve();
|
||||
|
||||
?>
|
||||
*
|
||||
* @param bool $repeat @deprecated
|
||||
* @deprecated 2.8.7
|
||||
*/
|
||||
public function approve( $repeat = true ) {
|
||||
$user_id = um_user( 'ID' );
|
||||
|
||||
if ( ! $repeat ) {
|
||||
$status = get_user_meta( $user_id, 'account_status', true );
|
||||
if ( 'approved' === $status ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
delete_option( "um_cache_userdata_{$user_id}" );
|
||||
|
||||
if ( 'awaiting_admin_review' === um_user( 'account_status' ) ) {
|
||||
$userdata = get_userdata( $user_id );
|
||||
|
||||
$this->maybe_generate_password_reset_key( $userdata );
|
||||
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'approved_email' );
|
||||
|
||||
} else {
|
||||
//$userdata = get_userdata( $user_id );
|
||||
//get_password_reset_key( $userdata );
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'welcome_email' );
|
||||
}
|
||||
|
||||
$this->set_status( 'approved' );
|
||||
$this->delete_meta( 'account_secret_hash' );
|
||||
$this->delete_meta( 'account_secret_hash_expiry' );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_after_user_is_approved
|
||||
* @description Action after user was approved
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_after_user_is_approved', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_after_user_is_approved', 'my_after_user_is_approved', 10, 1 );
|
||||
* function my_after_user_hash_is_changed( $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_user_is_approved', um_user( 'ID' ) );
|
||||
public function approve( $repeat = true ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- deprecated function
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->approve()' );
|
||||
UM()->common()->users()->approve( um_user( 'ID' ), $repeat );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pending email
|
||||
* @deprecated 2.8.7
|
||||
*/
|
||||
function email_pending() {
|
||||
$this->assign_secretkey();
|
||||
$this->set_status( 'awaiting_email_confirmation' );
|
||||
|
||||
//clear all sessions for email confirmation pending users
|
||||
$user = \WP_Session_Tokens::get_instance( um_user( 'ID' ) );
|
||||
$user->destroy_all();
|
||||
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'checkmail_email' );
|
||||
public function email_pending() {
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->send_activation()' );
|
||||
UM()->common()->users()->send_activation( um_user( 'ID' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method puts a user under manual review by administrator and sends them an optional email.
|
||||
*
|
||||
* @usage <?php UM()->user()->pending(); ?>
|
||||
*
|
||||
* @example An example of putting a user pending manual review
|
||||
|
||||
<?php
|
||||
|
||||
um_fetch_user( 54 );
|
||||
UM()->user()->pending();
|
||||
|
||||
?>
|
||||
*
|
||||
* @deprecated 2.8.7
|
||||
* @return void
|
||||
*/
|
||||
function pending() {
|
||||
$this->set_status( 'awaiting_admin_review' );
|
||||
|
||||
//clear all sessions for awaiting admin confirmation users
|
||||
$user = \WP_Session_Tokens::get_instance( um_user( 'ID' ) );
|
||||
$user->destroy_all();
|
||||
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'pending_email' );
|
||||
public function pending() {
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->set_as_pending()' );
|
||||
UM()->common()->users()->set_as_pending( um_user( 'ID' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method rejects a user membership and sends them an optional email.
|
||||
*
|
||||
* @usage <?php UM()->user()->reject(); ?>
|
||||
*
|
||||
* @example Reject a user membership example
|
||||
|
||||
<?php
|
||||
|
||||
um_fetch_user( 114 );
|
||||
UM()->user()->reject();
|
||||
|
||||
?>
|
||||
|
||||
*
|
||||
* @deprecated 2.8.7
|
||||
* @return void
|
||||
*/
|
||||
function reject() {
|
||||
$this->set_status( 'rejected' );
|
||||
|
||||
//clear all sessions for rejected users
|
||||
$user = \WP_Session_Tokens::get_instance( um_user( 'ID' ) );
|
||||
$user->destroy_all();
|
||||
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'rejected_email' );
|
||||
public function reject() {
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->reject()' );
|
||||
UM()->common()->users()->reject( um_user( 'ID' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method deactivates a user membership and sends them an optional email.
|
||||
*
|
||||
* @usage <?php UM()->user()->deactivate(); ?>
|
||||
*
|
||||
* @example Deactivate a user membership with the following example
|
||||
|
||||
<?php
|
||||
|
||||
um_fetch_user( 32 );
|
||||
$ultimatemember->user->deactivate();
|
||||
|
||||
?>
|
||||
*
|
||||
* @deprecated 2.8.7
|
||||
* @return void
|
||||
*/
|
||||
function deactivate() {
|
||||
$this->set_status( 'inactive' );
|
||||
|
||||
//clear all sessions for inactive users
|
||||
$user = \WP_Session_Tokens::get_instance( um_user( 'ID' ) );
|
||||
$user->destroy_all();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_after_user_is_inactive
|
||||
* @description Action after user was inactive
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_after_user_is_inactive', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_after_user_is_inactive', 'my_after_user_is_inactive', 10, 1 );
|
||||
* function my_after_user_is_inactive( $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_user_is_inactive', um_user( 'ID' ) );
|
||||
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'inactive_email' );
|
||||
public function deactivate() {
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->deactivate()' );
|
||||
UM()->common()->users()->deactivate( um_user( 'ID' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
*
|
||||
@@ -1970,28 +1727,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
function get_admin_actions() {
|
||||
$items = array();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_user_actions_hook
|
||||
* @description Extend admin actions for each user
|
||||
* @input_vars
|
||||
* [{"var":"$actions","type":"array","desc":"Actions for user"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_admin_user_actions_hook', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_user_actions_hook', 'my_admin_user_actions', 10, 1 );
|
||||
* function my_admin_user_actions( $actions ) {
|
||||
* // your code here
|
||||
* return $actions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$actions = apply_filters( 'um_admin_user_actions_hook', array(), um_profile_id() );
|
||||
$actions = UM()->frontend()->users()->get_actions_list( um_profile_id() );
|
||||
if ( empty( $actions ) ) {
|
||||
return $items;
|
||||
}
|
||||
@@ -2001,10 +1737,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
array(
|
||||
'um_action' => $id,
|
||||
'uid' => um_profile_id(),
|
||||
'nonce' => wp_create_nonce( $id . um_profile_id() ),
|
||||
)
|
||||
);
|
||||
/*$url = add_query_arg( 'um_action', $id );
|
||||
$url = add_query_arg( 'uid', um_profile_id(), $url );*/
|
||||
$items[] = '<a href="' . esc_url( $url ) . '" class="real_url ' . esc_attr( $id ) . '-item">' . esc_html( $arr['label'] ) . '</a>';
|
||||
}
|
||||
return $items;
|
||||
@@ -2356,32 +2091,15 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
/**
|
||||
* This method checks if a user exists or not in your site based on the user ID.
|
||||
*
|
||||
* @usage <?php UM()->user()->user_exists_by_id( $user_id ); ?>
|
||||
* @deprecated 2.8.7
|
||||
*
|
||||
* @param int $user_id A user ID must be passed to check if the user exists
|
||||
*
|
||||
* @return bool|int
|
||||
*
|
||||
* @example Basic Usage
|
||||
|
||||
<?php
|
||||
|
||||
$boolean = UM()->user()->user_exists_by_id( 15 );
|
||||
if ( $boolean ) {
|
||||
// That user exists
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
*
|
||||
*/
|
||||
public function user_exists_by_id( $user_id ) {
|
||||
$aux = get_userdata( absint( $user_id ) );
|
||||
if ( $aux == false ) {
|
||||
return false;
|
||||
} else {
|
||||
return $user_id;
|
||||
}
|
||||
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()::user_exists' );
|
||||
return UM()->common()->users()::user_exists( $user_id ) ? $user_id : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2522,7 +2240,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
return $hash_email_address;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM Placeholders for activation link in email
|
||||
*
|
||||
@@ -2530,12 +2247,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function add_activation_placeholder( $placeholders ) {
|
||||
public function add_activation_placeholder( $placeholders ) {
|
||||
$placeholders[] = '{account_activation_link}';
|
||||
return $placeholders;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM Replace Placeholders for activation link in email
|
||||
*
|
||||
@@ -2543,31 +2259,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function add_activation_replace_placeholder( $replace_placeholders ) {
|
||||
public function add_activation_replace_placeholder( $replace_placeholders ) {
|
||||
$replace_placeholders[] = um_user( 'account_activation_link' );
|
||||
return $replace_placeholders;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get pending users (in queue)
|
||||
*
|
||||
* @deprecated 2.4.2
|
||||
*/
|
||||
function get_pending_users_count() {
|
||||
_deprecated_function( __METHOD__, '2.4.2', 'UM()->query()->get_pending_users_count()' );
|
||||
return UM()->query()->get_pending_users_count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove cached queue from Users backend
|
||||
*
|
||||
* @deprecated 2.4.2
|
||||
*/
|
||||
function remove_cached_queue() {
|
||||
_deprecated_function( __METHOD__, '2.4.2', '' );
|
||||
delete_option( 'um_cached_users_queue' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,8 @@ if ( ! class_exists( 'um\core\rest\API_v1' ) ) {
|
||||
|
||||
switch ( $data ) {
|
||||
case 'status':
|
||||
UM()->user()->set_status( $value );
|
||||
//UM()->user()->set_status( $value );
|
||||
UM()->common()->users()->set_status( $id, $value );
|
||||
$response['success'] = __( 'User status has been changed.', 'ultimate-member' );
|
||||
break;
|
||||
case 'role':
|
||||
|
||||
@@ -221,7 +221,8 @@ if ( ! class_exists( 'um\core\rest\API_v2' ) ) {
|
||||
|
||||
switch ( $data ) {
|
||||
case 'status':
|
||||
UM()->user()->set_status( $value );
|
||||
// UM()->user()->set_status( $value );
|
||||
UM()->common()->users()->set_status( $id, $value );
|
||||
$response['success'] = __( 'User status has been changed.', 'ultimate-member' );
|
||||
break;
|
||||
case 'role':
|
||||
|
||||
@@ -326,7 +326,9 @@ function um_submit_account_details( $args ) {
|
||||
|
||||
if ( 'single_user_password' === $k || 'user_login' === $k ) {
|
||||
continue;
|
||||
} elseif ( 'first_name' === $k || 'last_name' === $k || 'user_password' === $k ) {
|
||||
}
|
||||
|
||||
if ( 'first_name' === $k || 'last_name' === $k || 'user_password' === $k ) {
|
||||
$v = sanitize_text_field( $v );
|
||||
} elseif ( 'user_email' === $k ) {
|
||||
$v = sanitize_email( $v );
|
||||
@@ -403,7 +405,7 @@ function um_submit_account_details( $args ) {
|
||||
*/
|
||||
do_action( 'um_account_pre_update_profile', $changes, $user_id );
|
||||
|
||||
if ( isset( $changes['first_name'] ) || isset( $changes['last_name'] ) || isset( $changes['nickname'] ) ) {
|
||||
if ( isset( $changes['first_name'] ) || isset( $changes['last_name'] ) || isset( $changes['nickname'] ) || isset( $changes['user_email'] ) ) {
|
||||
$user = get_userdata( $user_id );
|
||||
if ( ! empty( $user ) && ! is_wp_error( $user ) ) {
|
||||
UM()->user()->previous_data['display_name'] = $user->display_name;
|
||||
@@ -417,6 +419,9 @@ function um_submit_account_details( $args ) {
|
||||
if ( isset( $changes['nickname'] ) ) {
|
||||
UM()->user()->previous_data['nickname'] = $user->nickname;
|
||||
}
|
||||
if ( isset( $changes['user_email'] ) ) {
|
||||
UM()->user()->previous_data['user_email'] = $user->user_email;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +479,7 @@ function um_submit_account_details( $args ) {
|
||||
$url = add_query_arg( 'updated', 'account', $url );
|
||||
|
||||
if ( function_exists( 'icl_get_current_language' ) ) {
|
||||
if ( icl_get_current_language() != icl_get_default_language() ) {
|
||||
if ( icl_get_current_language() !== icl_get_default_language() ) {
|
||||
$url = UM()->permalinks()->get_current_url( true );
|
||||
$url = add_query_arg( 'updated', 'account', $url );
|
||||
|
||||
@@ -487,6 +492,31 @@ function um_submit_account_details( $args ) {
|
||||
}
|
||||
add_action( 'um_submit_account_details', 'um_submit_account_details' );
|
||||
|
||||
/**
|
||||
* Maybe clear all sessions except current after changing email. Because email can be used for login.
|
||||
* Using a proper hook that triggers on email changed action in WordPress native handlers.
|
||||
* It starts to work sitewide in UM Account and there wp_update_user with new user_email attribute is used.
|
||||
*
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @param bool $send Whether to send the email.
|
||||
* @param array $user The original user array.
|
||||
* @param array $userdata The updated user array.
|
||||
* @return bool
|
||||
*/
|
||||
function um_maybe_flush_users_session_update_user( $send, $user, $userdata ) {
|
||||
// Clear all sessions except current after changing email. Because email can be used for login.
|
||||
if ( get_current_user_id() === $userdata['ID'] ) {
|
||||
wp_destroy_other_sessions();
|
||||
} else {
|
||||
$sessions_manager = WP_Session_Tokens::get_instance( $userdata['ID'] );
|
||||
// Remove all the session data for all users.
|
||||
$sessions_manager->destroy_all();
|
||||
}
|
||||
|
||||
return $send;
|
||||
}
|
||||
add_filter( 'send_email_change_email', 'um_maybe_flush_users_session_update_user', 20, 3 );
|
||||
|
||||
/**
|
||||
* Hidden inputs for account form
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the requests of UM actions
|
||||
*
|
||||
*/
|
||||
function um_action_request_process() {
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $_REQUEST['um_action'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$action = sanitize_key( $_REQUEST['um_action'] );
|
||||
|
||||
$uid = 0;
|
||||
if ( isset( $_REQUEST['uid'] ) ) {
|
||||
$uid = absint( $_REQUEST['uid'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $uid ) && ! UM()->user()->user_exists_by_id( $uid ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $uid ) && is_super_admin( $uid ) ) {
|
||||
wp_die( esc_html__( 'Super administrators can not be modified.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$role = get_role( UM()->roles()->get_priority_user_role( get_current_user_id() ) );
|
||||
$can_edit_users = current_user_can( 'edit_users' ) && $role->has_cap( 'edit_users' );
|
||||
|
||||
switch ( $action ) {
|
||||
default:
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_action_user_request_hook
|
||||
* @description Integration for user actions
|
||||
* @input_vars
|
||||
* [{"var":"$action","type":"string","desc":"Action for user"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_action_user_request_hook', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_action_user_request_hook', 'my_action_user_request', 10, 2 );
|
||||
* function my_action_user_request( $action, $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_action_user_request_hook', $action, $uid );
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
UM()->fields()->editing = true;
|
||||
if ( ! um_is_myprofile() ) {
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
}
|
||||
} else {
|
||||
if ( ! um_can_edit_my_profile() ) {
|
||||
$url = um_edit_my_profile_cancel_uri();
|
||||
exit( wp_redirect( $url ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'um_switch_user':
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
UM()->user()->auto_login( $uid );
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_reject_membership':
|
||||
if ( ! $can_edit_users ) {
|
||||
wp_die( esc_html__( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->reject();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_approve_membership':
|
||||
case 'um_reenable':
|
||||
if ( ! $can_edit_users ) {
|
||||
wp_die( esc_html__( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ), 10, 1 );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ), 10, 1 );
|
||||
|
||||
UM()->user()->approve();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_put_as_pending':
|
||||
if ( ! $can_edit_users ) {
|
||||
wp_die( esc_html__( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->pending();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_resend_activation':
|
||||
if ( ! $can_edit_users ) {
|
||||
wp_die( esc_html__( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->user(), 'add_activation_placeholder' ), 10, 1 );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->user(), 'add_activation_replace_placeholder' ), 10, 1 );
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->email_pending();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_deactivate':
|
||||
if ( ! $can_edit_users ) {
|
||||
wp_die( esc_html__( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->deactivate();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_delete':
|
||||
if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to delete this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->delete();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'template_redirect', 'um_action_request_process', 10000 );
|
||||
@@ -417,13 +417,15 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
|
||||
um_reset_user();
|
||||
}
|
||||
|
||||
$restricted_fields = array();
|
||||
if ( 'profile' === $mode ) {
|
||||
$restricted_fields = UM()->fields()->get_restricted_fields_for_edit();
|
||||
}
|
||||
|
||||
foreach ( $fields as $key => $array ) {
|
||||
|
||||
if ( 'profile' === $mode ) {
|
||||
$restricted_fields = UM()->fields()->get_restricted_fields_for_edit();
|
||||
if ( is_array( $restricted_fields ) && in_array( $key, $restricted_fields, true ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'profile' === $mode && is_array( $restricted_fields ) && in_array( $key, $restricted_fields, true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$can_view = true;
|
||||
|
||||
@@ -226,6 +226,8 @@ function um_user_edit_profile( $args, $form_data ) {
|
||||
|
||||
// loop through fields
|
||||
if ( ! empty( $fields ) ) {
|
||||
$arr_restricted_fields = UM()->fields()->get_restricted_fields_for_edit( $user_id );
|
||||
|
||||
foreach ( $fields as $key => $array ) {
|
||||
if ( ! isset( $array['type'] ) ) {
|
||||
continue;
|
||||
@@ -253,8 +255,7 @@ function um_user_edit_profile( $args, $form_data ) {
|
||||
}
|
||||
|
||||
// fields that need to be disabled in edit mode (profile) (email, username, etc.)
|
||||
$arr_restricted_fields = UM()->fields()->get_restricted_fields_for_edit( $user_id );
|
||||
if ( in_array( $key, $arr_restricted_fields, true ) ) {
|
||||
if ( is_array( $arr_restricted_fields ) && in_array( $key, $arr_restricted_fields, true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -306,7 +307,7 @@ function um_user_edit_profile( $args, $form_data ) {
|
||||
//validation of correct values from options in wp-admin
|
||||
$stripslashes = '';
|
||||
if ( isset( $args['submitted'][ $key ] ) && is_string( $args['submitted'][ $key ] ) ) {
|
||||
$stripslashes = stripslashes( $args['submitted'][ $key ] );
|
||||
$stripslashes = wp_unslash( $args['submitted'][ $key ] );
|
||||
}
|
||||
|
||||
if ( 'select' === $array['type'] ) {
|
||||
@@ -361,7 +362,7 @@ function um_user_edit_profile( $args, $form_data ) {
|
||||
// translators: %s: title.
|
||||
$args['submitted'][ $key ] = sprintf( __( 'Your choosed %s', 'ultimate-member' ), $array['title'] );
|
||||
} else {
|
||||
if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) {
|
||||
if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] !== $userinfo[ $key ] ) {
|
||||
$to_update[ $key ] = $args['submitted'][ $key ];
|
||||
} elseif ( '' !== $args['submitted'][ $key ] ) {
|
||||
$to_update[ $key ] = $args['submitted'][ $key ];
|
||||
@@ -631,7 +632,6 @@ if ( ! function_exists( 'um_profile_remove_wpseo' ) ) {
|
||||
}
|
||||
add_action( 'get_header', 'um_profile_remove_wpseo', 8 );
|
||||
|
||||
|
||||
/**
|
||||
* The profile page SEO tags
|
||||
*
|
||||
@@ -641,10 +641,9 @@ add_action( 'get_header', 'um_profile_remove_wpseo', 8 );
|
||||
*/
|
||||
function um_profile_dynamic_meta_desc() {
|
||||
if ( um_is_core_page( 'user' ) && um_get_requested_user() ) {
|
||||
|
||||
$user_id = um_get_requested_user();
|
||||
|
||||
if ( $user_id !== um_user('ID') ) {
|
||||
if ( um_user( 'ID' ) !== $user_id ) {
|
||||
um_fetch_user( $user_id );
|
||||
}
|
||||
|
||||
@@ -674,48 +673,39 @@ function um_profile_dynamic_meta_desc() {
|
||||
$url = um_user_profile_url( $user_id );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* Filters the profile SEO image size. Default 190. Available 'original'.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_dynamic_meta_image_size
|
||||
* @description Change the profile SEO image size. Default 190. Available 'original'.
|
||||
* @input_vars
|
||||
* [{"var":"$image_size","type":"int|string","desc":"Image size"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.5.5"]
|
||||
* @usage add_filter( 'um_profile_dynamic_meta_image_size', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_dynamic_meta_image_size', 'my_profile_meta_image_size', 10, 2 );
|
||||
* function my_profile_meta_image_size( $image_size, $user_id ) {
|
||||
* // your code here
|
||||
* return $image_size;
|
||||
* @param {string} $image_size Image size.
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @return {array} Changed image type
|
||||
*
|
||||
* @since 2.5.5
|
||||
* @hook um_profile_dynamic_meta_image_size
|
||||
*
|
||||
* @example <caption>Change meta image to cover photo `cover_photo`.</caption>
|
||||
* function my_um_profile_dynamic_meta_image_size( $image_size, $user_id ) {
|
||||
* return 'original';
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_profile_dynamic_meta_image_size', 'my_um_profile_dynamic_meta_image_size', 10, 2 );
|
||||
*/
|
||||
$image_size = apply_filters( 'um_profile_dynamic_meta_image_size', 190, $user_id );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* Filters the profile SEO image type. Default 'profile_photo'. Available 'cover_photo', 'profile_photo'.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_dynamic_meta_image_type
|
||||
* @description Change the profile SEO image type. Default 'profile_photo'. Available 'cover_photo', 'profile_photo', .
|
||||
* @input_vars
|
||||
* [{"var":"$image_type","type":"string","desc":"Image type - cover_photo or profile_photo"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.5.5"]
|
||||
* @usage add_filter( 'um_profile_dynamic_meta_image_type', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_dynamic_meta_image_type', 'my_profile_meta_image_type', 10, 2 );
|
||||
* function my_profile_meta_image_type( $image_type, $user_id ) {
|
||||
* // your code here
|
||||
* return $image_type;
|
||||
* @param {string} $image_type Image type - cover_photo or profile_photo.
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @return {string} Changed image type
|
||||
*
|
||||
* @since 2.5.5
|
||||
* @hook um_profile_dynamic_meta_image_type
|
||||
*
|
||||
* @example <caption>Change meta image to cover photo `cover_photo`.</caption>
|
||||
* function my_um_profile_dynamic_meta_image_type( $image_type, $user_id ) {
|
||||
* return 'cover_photo';
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_profile_dynamic_meta_image_type', 'my_um_profile_dynamic_meta_image_type', 10, 2 );
|
||||
*/
|
||||
$image_type = apply_filters( 'um_profile_dynamic_meta_image_type', 'profile_photo', $user_id );
|
||||
|
||||
@@ -729,26 +719,56 @@ function um_profile_dynamic_meta_desc() {
|
||||
} else {
|
||||
$image = um_get_cover_uri( um_profile( 'cover_photo' ), null );
|
||||
}
|
||||
} else {
|
||||
if ( is_numeric( $image_size ) ) {
|
||||
$sizes = UM()->options()->get( 'photo_thumb_sizes' );
|
||||
if ( is_array( $sizes ) ) {
|
||||
$image_size = um_closest_num( $sizes, $image_size );
|
||||
}
|
||||
$image = um_get_user_avatar_url( $user_id, $image_size );
|
||||
} else {
|
||||
$image = um_get_user_avatar_url( $user_id, 'original' );
|
||||
} elseif ( is_numeric( $image_size ) ) {
|
||||
$sizes = UM()->options()->get( 'photo_thumb_sizes' );
|
||||
if ( is_array( $sizes ) ) {
|
||||
$image_size = um_closest_num( $sizes, $image_size );
|
||||
}
|
||||
$image = um_get_user_avatar_url( $user_id, $image_size );
|
||||
} else {
|
||||
$image = um_get_user_avatar_url( $user_id, 'original' );
|
||||
}
|
||||
|
||||
$image = current( explode( '?', $image ) ); // strip $_GET attributes from photo URL.
|
||||
$image_url = wp_parse_url( $image );
|
||||
$image_name = explode( '/', $image_url['path'] );
|
||||
$image_name = end( $image_name );
|
||||
$image_info = wp_check_filetype( $image_name );
|
||||
|
||||
$person = array(
|
||||
"@context" => "http://schema.org",
|
||||
"@type" => "Person",
|
||||
"name" => esc_attr( $title ),
|
||||
"description" => esc_attr( stripslashes( $description ) ),
|
||||
"image" => esc_url( $image ),
|
||||
"url" => esc_url( $url ),
|
||||
'@context' => 'https://schema.org',
|
||||
'@type' => 'ProfilePage',
|
||||
'dateCreated' => um_user( 'user_registered' ),
|
||||
'dateModified' => gmdate( 'Y-m-d H:i:s', um_user( 'last_update' ) ),
|
||||
'mainEntity' => array(
|
||||
'@type' => 'Person',
|
||||
'name' => esc_attr( $title ),
|
||||
'alternateName' => um_user( 'user_login' ),
|
||||
'description' => esc_attr( stripslashes( $description ) ),
|
||||
'image' => esc_url( $image ),
|
||||
'sameAs' => array(
|
||||
$url,
|
||||
),
|
||||
),
|
||||
);
|
||||
/**
|
||||
* Filters changing the schema.org of profile's person.
|
||||
*
|
||||
* @param {array} $person Data of the profile person.
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @return {array} Changed person's data.
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @hook um_profile_dynamic_meta_profile_schema
|
||||
*
|
||||
* @example <caption>Change name of person.</caption>
|
||||
* function my_um_profile_dynamic_meta_profile_schema( $core_search_fields ) {
|
||||
* $person['mainEntity']['name'] = 'John Doe';
|
||||
* }
|
||||
* add_filter( 'um_profile_dynamic_meta_profile_schema', 'my_um_profile_dynamic_meta_profile_schema' );
|
||||
*/
|
||||
$person = apply_filters( 'um_profile_dynamic_meta_profile_schema', $person, $user_id );
|
||||
|
||||
um_reset_user();
|
||||
?>
|
||||
@@ -766,14 +786,20 @@ function um_profile_dynamic_meta_desc() {
|
||||
<meta property="og:image" content="<?php echo esc_url( $image ); ?>"/>
|
||||
<meta property="og:image:alt" content="<?php esc_attr_e( 'Profile photo', 'ultimate-member' ); ?>"/>
|
||||
<?php if ( is_numeric( $image_size ) ) { ?>
|
||||
<meta property="og:image:height" content="<?php echo absint( $image_size ); ?>"/>
|
||||
<meta property="og:image:width" content="<?php echo absint( $image_size ); ?>"/>
|
||||
<meta property="og:image:height" content="<?php echo absint( $image_size ); ?>"/>
|
||||
<meta property="og:image:width" content="<?php echo absint( $image_size ); ?>"/>
|
||||
<?php } ?>
|
||||
<?php if ( is_ssl() ) { ?>
|
||||
<meta property="og:image:secure_url" content="<?php echo esc_url( $image ); ?>"/>
|
||||
<?php } ?>
|
||||
<?php if ( $image_info['type'] ) { ?>
|
||||
<meta property="og:image:type" content="<?php echo esc_attr( $image_info['type'] ); ?>" />
|
||||
<?php } ?>
|
||||
<meta property="og:url" content="<?php echo esc_url( $url ); ?>"/>
|
||||
|
||||
<meta name="twitter:card" content="summary"/>
|
||||
<?php if ( $twitter ) { ?>
|
||||
<meta name="twitter:site" content="@<?php echo esc_attr( $twitter ); ?>"/>
|
||||
<meta name="twitter:site" content="@<?php echo esc_attr( $twitter ); ?>"/>
|
||||
<?php } ?>
|
||||
<meta name="twitter:title" content="<?php echo esc_attr( $title ); ?>"/>
|
||||
<meta name="twitter:description" content="<?php echo esc_attr( $description ); ?>"/>
|
||||
@@ -781,7 +807,7 @@ function um_profile_dynamic_meta_desc() {
|
||||
<meta name="twitter:image:alt" content="<?php esc_attr_e( 'Profile photo', 'ultimate-member' ); ?>"/>
|
||||
<meta name="twitter:url" content="<?php echo esc_url( $url ); ?>"/>
|
||||
|
||||
<script type="application/ld+json"><?php echo json_encode( $person ); ?></script>
|
||||
<script type="application/ld+json"><?php echo wp_json_encode( $person ); ?></script>
|
||||
|
||||
<!-- END - Ultimate Member profile SEO meta tags -->
|
||||
<?php
|
||||
@@ -789,7 +815,6 @@ function um_profile_dynamic_meta_desc() {
|
||||
}
|
||||
add_action( 'wp_head', 'um_profile_dynamic_meta_desc', 20 );
|
||||
|
||||
|
||||
/**
|
||||
* Profile header cover
|
||||
*
|
||||
|
||||
@@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
function um_post_registration_approved_hook( $user_id ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
UM()->user()->approve();
|
||||
UM()->common()->users()->approve( $user_id, true );
|
||||
}
|
||||
add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook' );
|
||||
|
||||
@@ -23,7 +23,7 @@ add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved
|
||||
function um_post_registration_checkmail_hook( $user_id ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
UM()->user()->email_pending();
|
||||
UM()->common()->users()->send_activation( $user_id, true );
|
||||
}
|
||||
add_action( 'um_post_registration_checkmail_hook', 'um_post_registration_checkmail_hook' );
|
||||
|
||||
@@ -35,7 +35,7 @@ add_action( 'um_post_registration_checkmail_hook', 'um_post_registration_checkma
|
||||
function um_post_registration_pending_hook( $user_id ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
UM()->user()->pending();
|
||||
UM()->common()->users()->set_as_pending( $user_id, true );
|
||||
}
|
||||
add_action( 'um_post_registration_pending_hook', 'um_post_registration_pending_hook' );
|
||||
|
||||
@@ -64,7 +64,8 @@ function um_after_insert_user( $user_id, $args, $form_data = null ) {
|
||||
um_fetch_user( $user_id );
|
||||
$status = um_user( 'status' );
|
||||
}
|
||||
UM()->user()->set_status( $status );
|
||||
// UM()->user()->set_status( $status );
|
||||
UM()->common()->users()->set_status( $user_id, $status );
|
||||
|
||||
// Create user uploads directory.
|
||||
UM()->uploader()->get_upload_user_base_dir( $user_id, true );
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Profile name update
|
||||
|
||||
@@ -134,18 +134,22 @@ function um_profile_field_filter_hook__vimeo_video( $value, $data ) {
|
||||
}
|
||||
add_filter( 'um_profile_field_filter_hook__vimeo_video', 'um_profile_field_filter_hook__vimeo_video', 99, 2 );
|
||||
|
||||
|
||||
/**
|
||||
* Outputs a phone link
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
*
|
||||
* @return int|string
|
||||
* @return string
|
||||
*/
|
||||
function um_profile_field_filter_hook__phone( $value, $data ) {
|
||||
$value = '<a href="' . esc_url( 'tel:' . $value ) . '" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
|
||||
return $value;
|
||||
$maybe_empty_phone = trim( str_replace( '+', '', $value ) );
|
||||
if ( empty( $maybe_empty_phone ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$value = trim( $value );
|
||||
return '<a href="' . esc_url( 'tel:' . $value ) . '" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
|
||||
}
|
||||
add_filter( 'um_profile_field_filter_hook__tel', 'um_profile_field_filter_hook__phone', 99, 2 );
|
||||
|
||||
@@ -256,7 +260,7 @@ function um_profile_field_filter_hook__textarea( $value, $data ) {
|
||||
return '';
|
||||
}
|
||||
if ( ! empty( $data['html'] ) ) {
|
||||
return $value;
|
||||
return '<iframe class="um-textarea-html-value" title="' . esc_attr( $data['label'] ) . '" srcdoc="' . wp_kses_post( $value ) .'"></iframe>';
|
||||
}
|
||||
|
||||
$description_key = UM()->profile()->get_show_bio_key( UM()->fields()->global_args );
|
||||
@@ -456,7 +460,7 @@ function um_profile_field_filter_hook__( $value, $data, $type = '' ) {
|
||||
$value = '<a href="' . esc_url( $value, $protocols ) . '" title="' . esc_attr( $alt ) . '" target="' . esc_attr( $data['url_target'] ) . '" ' . $url_rel . '>' . esc_html( $alt ) . '</a>';
|
||||
} else {
|
||||
// check $value is oEmbed
|
||||
if ( 'oembed' === $data['type'] ) {
|
||||
if ( array_key_exists( 'type', $data ) && 'oembed' === $data['type'] ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ add_filter( 'get_canonical_url', 'um_get_canonical_url', 20, 2 );
|
||||
* @return array
|
||||
*/
|
||||
function um_change_profile_cover_photo_label( $fields ) {
|
||||
$max_size = UM()->files()->format_bytes( $fields['cover_photo']['max_size'] );
|
||||
$max_size = UM()->common()->filesystem()::format_bytes( $fields['cover_photo']['max_size'] );
|
||||
if ( ! empty( $max_size ) ) {
|
||||
list( $file_size, $unit ) = explode( ' ', $max_size );
|
||||
|
||||
@@ -148,7 +148,7 @@ add_filter( 'um_predefined_fields_hook', 'um_change_profile_cover_photo_label',
|
||||
* @return array
|
||||
*/
|
||||
function um_change_profile_photo_label( $fields ) {
|
||||
$max_size = UM()->files()->format_bytes( $fields['profile_photo']['max_size'] );
|
||||
$max_size = UM()->common()->filesystem()::format_bytes( $fields['profile_photo']['max_size'] );
|
||||
if ( ! empty( $max_size ) ) {
|
||||
list( $file_size, $unit ) = explode( ' ', $max_size );
|
||||
|
||||
|
||||
@@ -3,61 +3,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main admin user actions.
|
||||
*
|
||||
* @param array $actions
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function um_admin_user_actions_hook( $actions, $user_id ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
$role = get_role( UM()->roles()->get_priority_user_role( get_current_user_id() ) );
|
||||
|
||||
$can_edit_users = null !== $role && current_user_can( 'edit_users' ) && $role->has_cap( 'edit_users' );
|
||||
if ( $can_edit_users ) {
|
||||
$account_status = um_user( 'account_status' );
|
||||
|
||||
if ( 'awaiting_admin_review' === $account_status ) {
|
||||
$actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
|
||||
$actions['um_reject_membership'] = array( 'label' => __( 'Reject Membership', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( 'rejected' === $account_status ) {
|
||||
$actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( 'approved' === $account_status ) {
|
||||
$actions['um_put_as_pending'] = array( 'label' => __( 'Put as Pending Review', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( 'awaiting_email_confirmation' === $account_status ) {
|
||||
$actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation Email', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( 'inactive' !== $account_status ) {
|
||||
$actions['um_deactivate'] = array( 'label' => __( 'Deactivate this account', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( 'inactive' === $account_status ) {
|
||||
$actions['um_reenable'] = array( 'label' => __( 'Reactivate this account', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( UM()->roles()->um_current_user_can( 'delete', $user_id ) ) {
|
||||
$actions['um_delete'] = array( 'label' => __( 'Delete this user', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( current_user_can( 'manage_options' ) && ! is_super_admin( $user_id ) ) {
|
||||
$actions['um_switch_user'] = array( 'label' => __( 'Login as this user', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
return $actions;
|
||||
}
|
||||
add_filter( 'um_admin_user_actions_hook', 'um_admin_user_actions_hook', 10, 2 );
|
||||
|
||||
/**
|
||||
* Filter user basename.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
namespace um\frontend;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\frontend\Actions_Listener' ) ) {
|
||||
|
||||
/**
|
||||
* Class Actions_Listener
|
||||
*
|
||||
* @package um\frontend
|
||||
*/
|
||||
class Actions_Listener {
|
||||
|
||||
/**
|
||||
* Actions_Listener constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp_loaded', array( $this, 'actions_listener' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle frontend actions
|
||||
*
|
||||
* @since 2.8.7
|
||||
*/
|
||||
public function actions_listener() {
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return;
|
||||
}
|
||||
// phpcs:disable WordPress.Security.NonceVerification -- there is nonce verification below for each case
|
||||
if ( empty( $_REQUEST['um_action'] ) || empty( $_REQUEST['nonce'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user_id = 0;
|
||||
if ( isset( $_REQUEST['uid'] ) ) {
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $user_id ) && ! UM()->common()->users()::user_exists( $user_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( get_current_user_id() === $user_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $user_id ) && is_super_admin( $user_id ) ) {
|
||||
wp_die( esc_html__( 'Super administrators can not be modified.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$action = sanitize_key( $_REQUEST['um_action'] );
|
||||
// phpcs:enable WordPress.Security.NonceVerification -- there is nonce verification below for each case
|
||||
switch ( $action ) {
|
||||
case 'approve_user':
|
||||
if ( ! wp_verify_nonce( $_REQUEST['nonce'], "approve_user{$user_id}" ) ) {
|
||||
wp_die( esc_html__( 'The link you followed has expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to edit this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$result = UM()->common()->users()->approve( $user_id );
|
||||
if ( ! $result ) {
|
||||
wp_die( esc_html__( 'Something went wrong.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
case 'reactivate_user':
|
||||
if ( ! wp_verify_nonce( $_REQUEST['nonce'], "reactivate_user{$user_id}" ) ) {
|
||||
wp_die( esc_html__( 'The link you followed has expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to edit this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$result = UM()->common()->users()->reactivate( $user_id );
|
||||
if ( ! $result ) {
|
||||
wp_die( esc_html__( 'Something went wrong.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
case 'put_user_as_pending':
|
||||
if ( ! wp_verify_nonce( $_REQUEST['nonce'], "put_user_as_pending{$user_id}" ) ) {
|
||||
wp_die( esc_html__( 'The link you followed has expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to edit this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$result = UM()->common()->users()->set_as_pending( $user_id );
|
||||
if ( ! $result ) {
|
||||
wp_die( esc_html__( 'Something went wrong.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
case 'resend_user_activation':
|
||||
if ( ! wp_verify_nonce( $_REQUEST['nonce'], "resend_user_activation{$user_id}" ) ) {
|
||||
wp_die( esc_html__( 'The link you followed has expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to edit this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$result = UM()->common()->users()->send_activation( $user_id );
|
||||
if ( ! $result ) {
|
||||
wp_die( esc_html__( 'Something went wrong.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
case 'reject_user':
|
||||
if ( ! wp_verify_nonce( $_REQUEST['nonce'], "reject_user{$user_id}" ) ) {
|
||||
wp_die( esc_html__( 'The link you followed has expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to edit this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$result = UM()->common()->users()->reject( $user_id );
|
||||
if ( ! $result ) {
|
||||
wp_die( esc_html__( 'Something went wrong.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
case 'deactivate_user':
|
||||
if ( ! wp_verify_nonce( $_REQUEST['nonce'], "deactivate_user{$user_id}" ) ) {
|
||||
wp_die( esc_html__( 'The link you followed has expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to edit this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$result = UM()->common()->users()->deactivate( $user_id );
|
||||
if ( ! $result ) {
|
||||
wp_die( esc_html__( 'Something went wrong.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
case 'switch_user':
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! wp_verify_nonce( $_REQUEST['nonce'], "switch_user{$user_id}" ) ) {
|
||||
wp_die( esc_html__( 'The link you followed has expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
UM()->user()->auto_login( $user_id );
|
||||
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
case 'delete':
|
||||
if ( ! wp_verify_nonce( $_REQUEST['nonce'], "delete{$user_id}" ) ) {
|
||||
wp_die( esc_html__( 'The link you followed has expired.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->roles()->um_current_user_can( 'delete', $user_id ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to delete this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
UM()->user()->delete();
|
||||
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
default:
|
||||
/**
|
||||
* Fires to handle 3rd-party user actions from User Profile.
|
||||
*
|
||||
* Note: Please verify nonce and redirect after action individually in 3rd-party handler.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_action_user_request_hook
|
||||
*
|
||||
* @param {string} $action User action key.
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @example <caption>Update `some_custom_meta` user meta on `my_custom_action`.</caption>
|
||||
* function um_action_user_request_hook( $action, $user_id ) {
|
||||
* if ( 'my_custom_action' === $action ) {
|
||||
* update_user_meta( $user_id, 'some_custom_meta', true );
|
||||
* }
|
||||
* }
|
||||
* add_action( 'um_action_user_request_hook', 'um_action_user_request_hook', 10, 2 );
|
||||
*/
|
||||
do_action( 'um_action_user_request_hook', $action, $user_id );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,25 @@ if ( ! class_exists( 'um\frontend\Init' ) ) {
|
||||
* @used-by \UM::includes()
|
||||
*/
|
||||
public function includes() {
|
||||
$this->actions_listener();
|
||||
$this->enqueue();
|
||||
$this->modal();
|
||||
$this->secure();
|
||||
$this->user_profile();
|
||||
$this->users();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @return Actions_Listener
|
||||
*/
|
||||
public function actions_listener() {
|
||||
if ( empty( UM()->classes['um\frontend\actions_listener'] ) ) {
|
||||
UM()->classes['um\frontend\actions_listener'] = new Actions_Listener();
|
||||
}
|
||||
|
||||
return UM()->classes['um\frontend\actions_listener'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,5 +78,29 @@ if ( ! class_exists( 'um\frontend\Init' ) ) {
|
||||
}
|
||||
return UM()->classes['um\frontend\secure'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @return User_Profile
|
||||
*/
|
||||
public function user_profile() {
|
||||
if ( empty( UM()->classes['um\frontend\user_profile'] ) ) {
|
||||
UM()->classes['um\frontend\user_profile'] = new User_Profile();
|
||||
}
|
||||
return UM()->classes['um\frontend\user_profile'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.7
|
||||
*
|
||||
* @return Users
|
||||
*/
|
||||
public function users() {
|
||||
if ( empty( UM()->classes['um\frontend\users'] ) ) {
|
||||
UM()->classes['um\frontend\users'] = new Users();
|
||||
}
|
||||
return UM()->classes['um\frontend\users'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace um\frontend;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\frontend\User_Profile' ) ) {
|
||||
|
||||
/**
|
||||
* Class User_Profile
|
||||
*
|
||||
* @package um\frontend
|
||||
*/
|
||||
class User_Profile {
|
||||
|
||||
/**
|
||||
* User_Profile constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'template_redirect', array( $this, 'handle_edit_screen' ), 10000 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check edit profile action and set edit mode or redirect if there aren't capabilities to edit.
|
||||
* @return void
|
||||
*/
|
||||
public function handle_edit_screen() {
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $_REQUEST['um_action'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$action = sanitize_key( $_REQUEST['um_action'] );
|
||||
|
||||
if ( 'edit' !== $action ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uid = 0;
|
||||
if ( isset( $_REQUEST['uid'] ) ) {
|
||||
$uid = absint( $_REQUEST['uid'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $uid ) && ! UM()->common()->users()::user_exists( $uid ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $uid ) && is_super_admin( $uid ) ) {
|
||||
wp_die( esc_html__( 'Super administrators can not be modified.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
UM()->fields()->editing = true;
|
||||
|
||||
if ( ! um_is_myprofile() && ! UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
|
||||
um_safe_redirect( UM()->permalinks()->get_current_url( true ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! um_can_edit_my_profile() ) {
|
||||
um_safe_redirect( um_edit_my_profile_cancel_uri() );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace um\frontend;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Users
|
||||
*
|
||||
* @package um\frontend
|
||||
*/
|
||||
class Users {
|
||||
|
||||
public function hooks() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_actions_list( $user_id ) {
|
||||
$actions = array();
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
$priority_role = UM()->roles()->get_priority_user_role( get_current_user_id() );
|
||||
$role = get_role( $priority_role );
|
||||
|
||||
$can_edit_users = null !== $role && current_user_can( 'edit_users' ) && $role->has_cap( 'edit_users' );
|
||||
if ( $can_edit_users ) {
|
||||
if ( UM()->common()->users()->can_be_approved( $user_id ) ) {
|
||||
$actions['approve_user'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
|
||||
}
|
||||
if ( UM()->common()->users()->can_be_reactivated( $user_id ) ) {
|
||||
$actions['reactivate_user'] = array( 'label' => __( 'Reactivate this account', 'ultimate-member' ) );
|
||||
}
|
||||
if ( UM()->common()->users()->can_be_set_as_pending( $user_id ) ) {
|
||||
$actions['put_user_as_pending'] = array( 'label' => __( 'Put as Pending Review', 'ultimate-member' ) );
|
||||
}
|
||||
if ( UM()->common()->users()->can_activation_send( $user_id ) ) {
|
||||
$actions['resend_user_activation'] = array( 'label' => __( 'Resend Activation Email', 'ultimate-member' ) );
|
||||
}
|
||||
if ( UM()->common()->users()->can_be_rejected( $user_id ) ) {
|
||||
$actions['reject_user'] = array( 'label' => __( 'Reject Membership', 'ultimate-member' ) );
|
||||
}
|
||||
if ( UM()->common()->users()->can_be_deactivated( $user_id ) ) {
|
||||
$actions['deactivate_user'] = array( 'label' => __( 'Deactivate this account', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( UM()->roles()->um_current_user_can( 'delete', $user_id ) ) {
|
||||
$actions['delete'] = array( 'label' => __( 'Delete this user', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( current_user_can( 'manage_options' ) && ! is_super_admin( $user_id ) ) {
|
||||
$actions['switch_user'] = array( 'label' => __( 'Login as this user', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters users actions list in Ultimate Member frontend.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_admin_user_actions_hook
|
||||
*
|
||||
* @param {array} $actions CPT keys.
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @return {array} CPT keys.
|
||||
*
|
||||
* @example <caption>Add `um_custom_action` action to the users actions list on frontend.</caption>
|
||||
* function um_custom_admin_user_actions_hook( $actions, $user_id ) {
|
||||
* $actions['um_custom_action'] = array( 'label' => 'um_custom_action_label' );
|
||||
* return $actions;
|
||||
* }
|
||||
* add_filter( 'um_admin_user_actions_hook', 'um_custom_admin_user_actions_hook', 10, 2 );
|
||||
*/
|
||||
return apply_filters( 'um_admin_user_actions_hook', $actions, $user_id );
|
||||
}
|
||||
}
|
||||
@@ -45,3 +45,53 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
* }
|
||||
* add_filter( 'um_language_file', 'my_um_language_file' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires after user status changed.
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @depecated 2.8.7 use action hook `um_after_user_status_is_changed` instead.
|
||||
* @hook um_after_user_status_is_changed_hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires just before User status is changed.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @depecated 2.8.7 use action hook `um_before_user_status_is_set` instead.
|
||||
* @hook um_when_status_is_set
|
||||
*
|
||||
* @param {int} $user_id User ID. Since 2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires for handle admin user_action scripts.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @depecated 2.8.7 WordPress native `handle_bulk_actions-users` hook is used. Use action hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
* @hook um_admin_user_action_hook
|
||||
*
|
||||
* @param {string} $bulk_action Bulk action key
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires for handle admin user_action scripts.
|
||||
* Where $bulk_action is a bulk action key
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @depecated 2.8.7 WordPress native `handle_bulk_actions-users` hook is used. Use action hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
* @hook um_admin_user_action_{$bulk_action}_hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires for handle custom admin user_action scripts.
|
||||
* Where $action is a bulk action key
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @depecated 2.8.7 WordPress native `handle_bulk_actions-users` hook is used. Use action hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
* @hook um_admin_custom_hook_{$action}
|
||||
*
|
||||
* @param {int} $user_id User ID.
|
||||
*/
|
||||
|
||||
@@ -120,7 +120,6 @@ function um_replace_placeholders() {
|
||||
'{user_account_link}',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -1448,7 +1447,7 @@ function um_set_requested_user( $user_id ) {
|
||||
*/
|
||||
function um_get_requested_user() {
|
||||
if ( ! empty( UM()->user()->target_id ) ) {
|
||||
return UM()->user()->target_id;
|
||||
return absint( UM()->user()->target_id );
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1579,7 +1578,7 @@ function um_can_view_field( $data ) {
|
||||
|
||||
/**
|
||||
* Checks if user can view profile
|
||||
*
|
||||
* @todo make the function review. Maybe rewrite it.
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return bool
|
||||
|
||||
+66
-5
@@ -5,18 +5,18 @@ Contributors: ultimatemember, champsupertramp, nsinelnikov
|
||||
Tags: community, member, membership, user-profile, user-registration
|
||||
Requires PHP: 5.6
|
||||
Requires at least: 5.5
|
||||
Tested up to: 6.5
|
||||
Stable tag: 2.8.6
|
||||
Tested up to: 6.6
|
||||
Stable tag: 2.8.7
|
||||
License: GPLv3
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
The #1 plugin for front-end user profiles, user registration & login forms, member directories, content restriction, user roles and more.
|
||||
Membership & community plugin with user profiles, registration & login, member directories, content restriction, user roles and much more.
|
||||
|
||||
== Description ==
|
||||
|
||||
= Best User Profile & Membership Plugin for WordPress =
|
||||
= User Profile & Membership Plugin for WordPress =
|
||||
|
||||
Ultimate Member is the #1 user profile & membership plugin for WordPress. The plugin makes it a breeze for users to sign-up and become members of your website. The plugin allows you to add beautiful user profiles to your site and is perfect for creating advanced online communities and membership sites. Lightweight and highly extendible, Ultimate Member will enable you to create almost any type of site where users can join and become members with absolute ease.
|
||||
The ultimate user profile & membership plugin for WordPress. The plugin makes it a breeze for users to sign-up and become members of your website. The plugin allows you to add beautiful user profiles to your site and is designed for creating advanced online communities and membership sites. Lightweight and highly extendible, Ultimate Member will enable you to create almost any type of site where users can join and become members with absolute ease.
|
||||
|
||||
= Features of the plugin include: =
|
||||
|
||||
@@ -166,6 +166,63 @@ No specific extensions are needed. But we highly recommended keep active these P
|
||||
|
||||
IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION
|
||||
|
||||
= 2.8.7 2024-09-30 =
|
||||
|
||||
**Enhancements**
|
||||
|
||||
* Added: Single user actions on WP Users list table
|
||||
* Updated: User status filter on WP Users list table
|
||||
* Updated: User bulk actions on WP Users list table
|
||||
* Updated: User actions on User Profile and Member Directory card
|
||||
* Added: Applying shortcodes in the post restriction message
|
||||
* Added: ProfilePage Structured Data
|
||||
* Added: Ability to use HTML tags (allowed in `wp_kses_post`) in the global block restriction message
|
||||
* Changed: Some wp-admin fields descriptions
|
||||
* Updated: Data format in `um_admin_bulk_user_actions_hook` hook. Changed format from `$action_slug => array( 'label' => $action_title )` to `$action_slug => $action_title`
|
||||
* Added: `$old_status` param to `um_after_user_status_is_changed` hook
|
||||
* Added: `$user_id` param to `um_before_user_hash_is_changed` hook
|
||||
* Added: `$user_id, $hash, $expiration` params to `um_after_user_hash_is_changed` hook
|
||||
* Added: `um_restricted_post_content` hook
|
||||
* Added: `um_loggedin_inner_content` hook
|
||||
* Added: `um_profile_dynamic_meta_profile_schema` hook
|
||||
|
||||
**Bugfixes**
|
||||
|
||||
* Fixed: Single user action on User Profile security vulnerability. CVE ID: CVE-2024-8520
|
||||
* Fixed: [um_loggedin] shortcode security vulnerability. CVE ID: CVE-2024-8519
|
||||
* Fixed: Performance issue related to Settings > Secure tab
|
||||
* Fixed: The "Clear All" button in the member directory did not reset all dependent dropdowns
|
||||
* Fixed: Telegram and Discord social links in profile header
|
||||
* Fixed: UM links to empty phone numbers
|
||||
* Fixed: Email changing via User Account flush session. Security enhancement because email can be used for login
|
||||
* Fixed: User Profile image URL in meta tags
|
||||
* Fixed: Empty User Profile and PHP Fatal error when cannot get profile field data
|
||||
* Fixed: Parsing /modal/ templates and parsing templates on the Windows hosting
|
||||
* Fixed: Validation `form_id` attribute in the `ultimatemember` shortcode
|
||||
|
||||
**Templates required update**
|
||||
|
||||
* login-to-view.php
|
||||
|
||||
**Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade**
|
||||
|
||||
**Deprecated**
|
||||
|
||||
Hook: `um_after_user_status_is_changed_hook`. Use action hook `um_after_user_status_is_changed` instead.
|
||||
Hook: `um_when_status_is_set`. Use action hook `um_before_user_status_is_set` instead.
|
||||
Hook: `um_admin_user_action_hook`. Use action hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
Hook: `um_admin_user_action_{$bulk_action}_hook`. Use action hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
Hook: `um_admin_custom_hook_{$action}`. Use action hook `um_handle_bulk_actions-users-{$current_action}` for custom user bulk actions instead.
|
||||
Function: `UM()->user()->set_status( $status )`. Use function `UM()->common()->users()->set_status( $status, $user_id )` instead.
|
||||
Function: `UM()->user()->assign_secretkey()`. Use function `UM()->common()->users()->assign_secretkey( $user_id )` instead.
|
||||
Function: `UM()->user()->approve( $repeat )`. Use function `UM()->common()->users()->approve( $user_id, $force )` instead.
|
||||
Function: `UM()->user()->email_pending()`. Use function `UM()->common()->users()->approve( $user_id, $force )` instead.
|
||||
Function: `UM()->user()->pending()`. Use function `UM()->common()->users()->set_as_pending( $user_id, $force )` instead.
|
||||
Function: `UM()->user()->reject()`. Use function `UM()->common()->users()->reject( $user_id, $force )` instead.
|
||||
Function: `UM()->user()->deactivate()`. Use function `UM()->common()->users()->deactivate( $user_id, $force )` instead.
|
||||
Function: `UM()->user()->user_exists_by_id( $user_id )`. Use function `UM()->common()->users()::user_exists( $user_id )` instead.
|
||||
Function: `UM()->files()->format_bytes( $size )`. Use function `UM()->common()->filesystem()::format_bytes( $size )` instead.
|
||||
|
||||
= 2.8.6 2024-05-22 =
|
||||
|
||||
**Enhancements**
|
||||
@@ -189,6 +246,7 @@ IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSI
|
||||
* Fixed: Sorting by last login value when "Hide my last login" is set
|
||||
* Fixed: PHP errors while uploading files
|
||||
* Fixed: Parsing error on the license activation
|
||||
* Fixed: Saving field value when type is textarea and using HTML is enabled
|
||||
|
||||
**Templates required update**
|
||||
|
||||
@@ -364,6 +422,9 @@ IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSI
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 2.8.7 =
|
||||
This version fixes a security related bug. Upgrade immediately.
|
||||
|
||||
= 2.8.5 =
|
||||
This version fixes a security related bug. Upgrade immediately.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the account page
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/account.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/account.php
|
||||
*
|
||||
* Page: "Account"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the GDPR checkbox in register form
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/gdpr-register.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/gdpr-register.php
|
||||
*
|
||||
* Page: "Register"
|
||||
* Call: function display_option()
|
||||
|
||||
@@ -2,20 +2,18 @@
|
||||
/**
|
||||
* Template for the login only content, locked message
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/login-to-view.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/login-to-view.php
|
||||
*
|
||||
* Call: function um_loggedin()
|
||||
*
|
||||
* @version 2.6.1
|
||||
* @version 2.8.7
|
||||
*
|
||||
* @var string $lock_text
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} ?>
|
||||
|
||||
}
|
||||
?>
|
||||
<div class="um-locked-content">
|
||||
|
||||
<div class="um-locked-content-msg"><?php echo htmlspecialchars_decode( $lock_text ); ?></div>
|
||||
|
||||
<div class="um-locked-content-msg"><?php echo wp_kses( $lock_text, UM()->get_allowed_html( 'templates' ) ); ?></div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the login form
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/login.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/login.php
|
||||
*
|
||||
* Page: "Login"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the logout
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/logout.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/logout.php
|
||||
*
|
||||
* Page: "Logout"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the members directory grid
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/members-grid.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/members-grid.php
|
||||
*
|
||||
* Page: "Members"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the members directory header JS-template
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/members-header.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/members-header.php
|
||||
*
|
||||
* Page: "Members"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the members directory list
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/members-list.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/members-list.php
|
||||
*
|
||||
* Page: "Members"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the members directory pagination JS template
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/members-pagination.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/members-pagination.php
|
||||
*
|
||||
* Page: "Members"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the members directory
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/members.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/members.php
|
||||
*
|
||||
* Page: "Members"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the message after registration process
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/message.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/message.php
|
||||
*
|
||||
* Call: function parse_shortcode_args()
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the modal form
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/modal/upload-single.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/modal/upload-single.php
|
||||
*
|
||||
* @version 2.8.6
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the modal photo
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/modal/view-photo.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/modal/view-photo.php
|
||||
*
|
||||
* @version 2.8.6
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the password change
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/password-change.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/password-change.php
|
||||
*
|
||||
* Call: function ultimatemember_password()
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the password reset
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/password-reset.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/password-reset.php
|
||||
*
|
||||
* Call: function ultimatemember_password()
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the profile page
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/profile.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/profile.php
|
||||
*
|
||||
* Page: "Profile"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the profile single comments
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/profile/comments-single.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/profile/comments-single.php
|
||||
*
|
||||
* Page: "Profile"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the profile comments
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/profile/comments.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/profile/comments.php
|
||||
*
|
||||
* Page: "Profile"
|
||||
* Call: function add_comments(), function load_comments()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the profile single post
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/profile/posts-single.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/profile/posts-single.php
|
||||
*
|
||||
* Page: "Profile"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the profile posts
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/profile/posts.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/profile/posts.php
|
||||
*
|
||||
* Page: "Profile"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the register page
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/register.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/templates/register.php
|
||||
*
|
||||
* Page: "Register"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the blog restricted message
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/restricted-blog.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/restricted-blog.php
|
||||
*
|
||||
* Call: function blog_message()
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the taxonomy restricted message
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/restricted-taxonomy.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/restricted-taxonomy.php
|
||||
*
|
||||
* Call: function taxonomy_message()
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the search form
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/searchform.php
|
||||
* This template can be overridden by copying it to your-theme/ultimate-member/searchform.php
|
||||
*
|
||||
* Call: function ultimatemember_searchform()
|
||||
*
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: Ultimate Member
|
||||
* Plugin URI: http://ultimatemember.com/
|
||||
* Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
||||
* Version: 2.8.6
|
||||
* Version: 2.8.7
|
||||
* Author: Ultimate Member
|
||||
* Author URI: http://ultimatemember.com/
|
||||
* Text Domain: ultimate-member
|
||||
|
||||
Reference in New Issue
Block a user