mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed user profile page permalinks;
This commit is contained in:
@@ -7,7 +7,7 @@ Ultimate Member is the #1 user profile & membership plugin for WordPress. The pl
|
||||
|
||||
| Latest Version |Requires at least|Stable Tag|
|
||||
| :------------: |:------------:|:------------:|
|
||||
| 2.0.5 | WordPress 4.9 or higher| 2.0.5 |
|
||||
| 2.0.7 | WordPress 4.9 or higher| 2.0.7 |
|
||||
|
||||
|
||||
Features of the plugin include:
|
||||
@@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version
|
||||
|
||||
Releases
|
||||
====================
|
||||
[Official Release Version: 2.0.5](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.5).
|
||||
[Official Release Version: 2.0.7](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.7).
|
||||
|
||||
[Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases).
|
||||
|
||||
|
||||
@@ -45,8 +45,46 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
||||
add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) );
|
||||
add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) );
|
||||
}
|
||||
|
||||
//add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for major updates
|
||||
*
|
||||
*/
|
||||
/*function in_plugin_update_message( $args ) {
|
||||
|
||||
$lastversion = get_option( '%UNIQUE_ID%_last_version', false );
|
||||
if ( $lastversion && version_compare( $lastversion, %UNIQUE_ID%_current_version, '>' ) ) {
|
||||
$upgrade_notice = get_option( '%UNIQUE_ID%_major_update' . $lastversion );
|
||||
|
||||
echo '<style type="text/css">
|
||||
.%UNIQUE_ID%_plugin_upgrade_notice {
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
background: #d53221;
|
||||
padding: 1em;
|
||||
margin: 9px 0;
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
||||
.%UNIQUE_ID%_plugin_upgrade_notice:before {
|
||||
content: "\f348";
|
||||
display: inline-block;
|
||||
font: 400 18px/1 dashicons;
|
||||
speak: none;
|
||||
margin: 0 8px 0 -2px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
vertical-align: top;
|
||||
}
|
||||
</style>' . wp_kses_post( $upgrade_notice );
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* Get array of necessary upgrade packages
|
||||
|
||||
@@ -539,7 +539,6 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->plugin_updater();
|
||||
} elseif ( $this->is_request( 'frontend' ) ) {
|
||||
$this->enqueue();
|
||||
$this->rewrite();
|
||||
$this->account();
|
||||
$this->password();
|
||||
$this->login();
|
||||
@@ -551,6 +550,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
|
||||
//common includes
|
||||
$this->rewrite();
|
||||
$this->mail();
|
||||
$this->rest_api();
|
||||
$this->shortcodes();
|
||||
|
||||
@@ -18,16 +18,14 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
* Rewrite constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
//add rewrite rules
|
||||
add_filter( 'query_vars', array(&$this, 'query_vars'), 10, 1 );
|
||||
|
||||
add_filter( 'rewrite_rules_array', array( &$this, '_add_rewrite_rules' ), 10, 1 );
|
||||
add_action( 'init', array( &$this, 'rewrite_rules'), 100000000 );
|
||||
|
||||
|
||||
add_action( 'template_redirect', array( &$this, 'redirect_author_page'), 9999 );
|
||||
|
||||
add_action( 'template_redirect', array( &$this, 'locate_user_profile'), 9999 );
|
||||
|
||||
//add rewrite rules
|
||||
add_filter( 'rewrite_rules_array', array( &$this, '_add_rewrite_rules' ), 10, 1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -66,35 +64,23 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
|
||||
$newrules['um-api/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?um_page=api&um_action=$matches[1]&um_resource=$matches[2]&um_method=$matches[3]&um_verify=$matches[4]';
|
||||
|
||||
return $newrules + $rules;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup rewrite rules
|
||||
*/
|
||||
function rewrite_rules() {
|
||||
|
||||
if ( isset( UM()->config()->permalinks['user'] ) ) {
|
||||
|
||||
$user_page_id = UM()->config()->permalinks['user'];
|
||||
$account_page_id = UM()->config()->permalinks['account'];
|
||||
$user = get_post($user_page_id);
|
||||
$user = get_post( $user_page_id );
|
||||
|
||||
if ( isset( $user->post_name ) ) {
|
||||
|
||||
$user_slug = $user->post_name;
|
||||
$account = get_post($account_page_id);
|
||||
$account_slug = $account->post_name;
|
||||
|
||||
$add_lang_code = '';
|
||||
$language_code = '';
|
||||
|
||||
if ( function_exists('icl_object_id') || function_exists('icl_get_current_language') ) {
|
||||
if ( function_exists('icl_object_id') || function_exists('icl_get_current_language') ) {
|
||||
|
||||
if( function_exists('icl_get_current_language') ){
|
||||
if ( function_exists('icl_get_current_language') ) {
|
||||
$language_code = icl_get_current_language();
|
||||
}else if( function_exists('icl_object_id') && defined('ICL_LANGUAGE_CODE') ){
|
||||
} elseif( function_exists('icl_object_id') && defined('ICL_LANGUAGE_CODE') ) {
|
||||
$language_code = ICL_LANGUAGE_CODE;
|
||||
}
|
||||
|
||||
@@ -105,53 +91,89 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
$user_slug = $lang_post_obj->post_name;
|
||||
}
|
||||
|
||||
// Account page translated slug
|
||||
$lang_post_id = icl_object_id( $account->ID, 'post', FALSE, $language_code );
|
||||
$lang_post_obj = get_post( $lang_post_id );
|
||||
if( isset( $lang_post_obj->post_name ) ){
|
||||
$account_slug = $lang_post_obj->post_name;
|
||||
}
|
||||
|
||||
if( $language_code != icl_get_default_language() ){
|
||||
$add_lang_code = $language_code;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_rewrite_rule( $user_slug.'/([^/]+)/?$',
|
||||
'index.php?page_id='.$user_page_id.'&um_user=$matches[1]&lang='.$add_lang_code,
|
||||
'top'
|
||||
);
|
||||
$newrules[ $user_slug.'/([^/]+)/?$' ] = 'index.php?page_id='.$user_page_id.'&um_user=$matches[1]&lang='.$add_lang_code;
|
||||
}
|
||||
}
|
||||
|
||||
add_rewrite_rule( $account_slug.'/([^/]+)?$',
|
||||
'index.php?page_id='.$account_page_id.'&um_tab=$matches[1]&lang='.$add_lang_code,
|
||||
'top'
|
||||
);
|
||||
if ( isset( UM()->config()->permalinks['account'] ) ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_rewrite_flush_rewrite_rules
|
||||
* @description Enable flushing rewrite rules
|
||||
* @input_vars
|
||||
* [{"var":"$stop_flush","type":"bool","desc":"Stop flushing rewrite rules"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_rewrite_flush_rewrite_rules', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_rewrite_flush_rewrite_rules', 'my_rewrite_flush_rewrite_rules', 10, 1 );
|
||||
* function my_rewrite_flush_rewrite_rules( $stop_flush ) {
|
||||
* // your code here
|
||||
* return $stop_flush;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
if ( ! apply_filters( 'um_rewrite_flush_rewrite_rules', UM()->options()->get( 'um_flush_stop' ) ) )
|
||||
flush_rewrite_rules( true );
|
||||
$account_page_id = UM()->config()->permalinks['account'];
|
||||
$account = get_post( $account_page_id );
|
||||
|
||||
if ( isset( $account->post_name ) ) {
|
||||
|
||||
$account_slug = $account->post_name;
|
||||
|
||||
$add_lang_code = '';
|
||||
$language_code = '';
|
||||
|
||||
if ( function_exists('icl_object_id') || function_exists('icl_get_current_language') ) {
|
||||
|
||||
if ( function_exists('icl_get_current_language') ){
|
||||
$language_code = icl_get_current_language();
|
||||
} elseif( function_exists('icl_object_id') && defined('ICL_LANGUAGE_CODE') ) {
|
||||
$language_code = ICL_LANGUAGE_CODE;
|
||||
}
|
||||
|
||||
// Account page translated slug
|
||||
$lang_post_id = icl_object_id( $account->ID, 'post', FALSE, $language_code );
|
||||
$lang_post_obj = get_post( $lang_post_id );
|
||||
if ( isset( $lang_post_obj->post_name ) ){
|
||||
$account_slug = $lang_post_obj->post_name;
|
||||
}
|
||||
|
||||
if ( $language_code != icl_get_default_language() ) {
|
||||
$add_lang_code = $language_code;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$newrules[ $account_slug.'/([^/]+)?$' ] = 'index.php?page_id='.$account_page_id.'&um_tab=$matches[1]&lang='.$add_lang_code;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $newrules + $rules;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup rewrite rules
|
||||
*/
|
||||
function rewrite_rules() {
|
||||
|
||||
if ( isset( UM()->config()->permalinks['user'] ) && isset( UM()->config()->permalinks['account'] ) ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_rewrite_flush_rewrite_rules
|
||||
* @description Enable flushing rewrite rules
|
||||
* @input_vars
|
||||
* [{"var":"$stop_flush","type":"bool","desc":"Stop flushing rewrite rules"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_rewrite_flush_rewrite_rules', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_rewrite_flush_rewrite_rules', 'my_rewrite_flush_rewrite_rules', 10, 1 );
|
||||
* function my_rewrite_flush_rewrite_rules( $stop_flush ) {
|
||||
* // your code here
|
||||
* return $stop_flush;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
if ( ! apply_filters( 'um_rewrite_flush_rewrite_rules', UM()->options()->get( 'um_flush_stop' ) ) ) {
|
||||
flush_rewrite_rules( true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
-2
@@ -1,4 +1,4 @@
|
||||
=== Ultimate Member - User Profile & Membership Plugin ===
|
||||
=== Ultimate Member - User Profile & Membership Plugin ===
|
||||
Author URI: https://ultimatemember.com/
|
||||
Plugin URI: https://ultimatemember.com/
|
||||
Contributors: ultimatemember, champsupertramp, nsinelnikov
|
||||
@@ -6,7 +6,7 @@ Donate link:
|
||||
Tags: community, member, membership, user-profile, user-registration
|
||||
Requires at least: 4.1
|
||||
Tested up to: 4.9
|
||||
Stable tag: 2.0.5
|
||||
Stable tag: 2.0.7
|
||||
License: GNU Version 2 or Any Later Version
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
@@ -129,6 +129,15 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.0.7: xxxx, 2018 =
|
||||
|
||||
* Bugfixes:
|
||||
- Fixed add rewrite rules for UM pages
|
||||
|
||||
= 2.0.6: April 12, 2018 =
|
||||
|
||||
* Bugfixes:
|
||||
- Fixed nav-menu content restriction issues for Administrator role
|
||||
|
||||
= 2.0.5: April 12, 2018 =
|
||||
|
||||
|
||||
+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.0.5
|
||||
Version: 2.0.7
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
Text Domain: ultimate-member
|
||||
|
||||
Reference in New Issue
Block a user