- fixed bbPress restrict content message on forums;

- fixed issues with permalinks (issue #375);
- fixed replacing placeholders in [show_content_for_role] shortcode;
This commit is contained in:
nikitozzzzzzz
2018-02-18 13:27:46 +02:00
parent 440aa59b28
commit cbf06f5835
14 changed files with 170 additions and 269 deletions
+23 -1
View File
@@ -9,6 +9,7 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
var $settings_structure;
var $previous_licenses;
var $need_change_permalinks;
function __construct() {
//init settings structure
@@ -37,6 +38,7 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
add_action( 'admin_init', array( $this, 'save_settings_handler' ), 10 );
//save pages options
add_action( 'um_settings_before_save', array( $this, 'check_permalinks_changes' ) );
add_action( 'um_settings_save', array( $this, 'on_settings_save' ) );
@@ -1284,9 +1286,18 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
}
function check_permalinks_changes() {
if ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
if ( UM()->options()->get( 'permalink_base' ) != $_POST['um_options']['permalink_base'] ) {
$this->need_change_permalinks = true;
}
}
}
function on_settings_save() {
if ( ! empty( $_POST['um_options'] ) ) {
if ( ! empty( $_POST['pages_settings'] ) ) {
if ( ! empty( $_POST['um_options']['pages_settings'] ) ) {
$post_ids = new \WP_Query( array(
'post_type' => 'page',
'meta_query' => array(
@@ -1311,6 +1322,17 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
$slug = str_replace( 'core_', '', $option_slug );
update_post_meta( $post_id, '_um_core', $slug );
}
} elseif ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
if ( ! empty( $this->need_change_permalinks ) ) {
$users = get_users( array(
'fields' => 'ids',
) );
if ( ! empty( $users ) ) {
foreach ( $users as $user_id ) {
UM()->user()->generate_profile_slug( $user_id );
}
}
}
}
}
}
+1 -1
View File
@@ -95,7 +95,7 @@ if ( ! class_exists( 'Admin_Users' ) ) {
function user_row_actions( $actions, $user_object ) {
$user_id = $user_object->ID;
$actions['frontend_profile'] = "<a class='' href='" . UM()->user()->get_profile_url( $user_id ) . "'>" . __( 'View profile', 'ultimate-member' ) . "</a>";
$actions['frontend_profile'] = "<a class='' href='" . UM()->user()->get_profile_link( $user_id ) . "'>" . __( 'View profile', 'ultimate-member' ) . "</a>";
$submitted = get_user_meta( $user_id, 'submitted', true );
if ( ! empty( $submitted ) )