- code review;

This commit is contained in:
nikitasinelnikov
2020-07-08 19:34:40 +03:00
parent ea86441823
commit 3d8b9f7cf4
4 changed files with 11 additions and 16 deletions
+2 -7
View File
@@ -30,18 +30,11 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
* Permalinks constructor. * Permalinks constructor.
*/ */
function __construct() { function __construct() {
add_action( 'init', array( &$this, 'set_current_url' ), 0 ); add_action( 'init', array( &$this, 'set_current_url' ), 0 );
add_action( 'init', array( &$this, 'check_for_querystrings' ), 1 ); add_action( 'init', array( &$this, 'check_for_querystrings' ), 1 );
add_action( 'init', array( &$this, 'activate_account_via_email_link' ), 1 ); add_action( 'init', array( &$this, 'activate_account_via_email_link' ), 1 );
//add_action( 'um_user_after_updating_profile', array( &$this, 'profile_url' ), 1 );
/* @deprecated since version 2.1.7 */
//remove_action( 'wp_head', 'rel_canonical' );
//add_action( 'wp_head', array( &$this, 'um_rel_canonical_' ), 9 );
} }
@@ -55,7 +48,9 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
/** /**
* SEO canonical href bugfix * SEO canonical href bugfix
*
* @deprecated since version 2.1.7 * @deprecated since version 2.1.7
*
* @see function um_profile_remove_wpseo() * @see function um_profile_remove_wpseo()
*/ */
function um_rel_canonical_() { function um_rel_canonical_() {
+2 -2
View File
@@ -609,10 +609,10 @@ if ( !function_exists( 'um_profile_remove_wpseo' ) ) {
remove_all_filters( 'wpseo_head' ); remove_all_filters( 'wpseo_head' );
/* Restore title and canonical if broken */ /* Restore title and canonical if broken */
if( ! has_action( 'wp_head', '_wp_render_title_tag' ) ){ if ( ! has_action( 'wp_head', '_wp_render_title_tag' ) ) {
add_action( 'wp_head', '_wp_render_title_tag', 18 ); add_action( 'wp_head', '_wp_render_title_tag', 18 );
} }
if( ! has_action( 'wp_head', 'rel_canonical' ) ){ if ( ! has_action( 'wp_head', 'rel_canonical' ) ) {
add_action( 'wp_head', 'rel_canonical', 18 ); add_action( 'wp_head', 'rel_canonical', 18 );
} }
} }
+6 -7
View File
@@ -84,9 +84,8 @@ add_filter( 'the_title', 'um_dynamic_user_profile_title', 100000, 2 );
* @param WP_Post $post Optional. Post ID or object. Default is global `$post`. * @param WP_Post $post Optional. Post ID or object. Default is global `$post`.
* @return string|false The canonical URL, or false if current URL is canonical. * @return string|false The canonical URL, or false if current URL is canonical.
*/ */
function um_get_canonical_url( $canonical_url, $post ){ function um_get_canonical_url( $canonical_url, $post ) {
if ( UM()->config()->permalinks['user'] == $post->ID ) {
if( UM()->config()->permalinks['user'] == $post->ID ) {
/** /**
* UM hook * UM hook
@@ -109,13 +108,13 @@ function um_get_canonical_url( $canonical_url, $post ){
* } * }
* ?> * ?>
*/ */
$enable_canonical = apply_filters( "um_allow_canonical__filter", true ); $enable_canonical = apply_filters( 'um_allow_canonical__filter', true );
if( $enable_canonical ){ if ( $enable_canonical ) {
$url = um_user_profile_url( um_get_requested_user() ); $url = um_user_profile_url( um_get_requested_user() );
$canonical_url = $url === home_url( $_SERVER['REQUEST_URI'] ) ? false : $url; $canonical_url = ( $url === home_url( $_SERVER['REQUEST_URI'] ) ) ? false : $url;
if ( $page = get_query_var('cpage') ){ if ( $page = get_query_var( 'cpage' ) ) {
$canonical_url = get_comments_pagenum_link( $page ); $canonical_url = get_comments_pagenum_link( $page );
} }
} }
+1
View File
@@ -151,6 +151,7 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
- Fixed password reset/change form when other forms are initialized at the same page - Fixed password reset/change form when other forms are initialized at the same page
- Fixed getting extension updates on multisites - Fixed getting extension updates on multisites
- Fixed the 'wp_authenticate_user' filter's variables (changed username string to WP_User object) - Fixed the 'wp_authenticate_user' filter's variables (changed username string to WP_User object)
- Fixed SEO link canonical for the profile page
- Deprecated JS event 'um_before_modal_removed', use wp.hooks action 'um_before_modal_removed' instead - Deprecated JS event 'um_before_modal_removed', use wp.hooks action 'um_before_modal_removed' instead
= 2.1.6: June 1, 2020 = = 2.1.6: June 1, 2020 =