mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
New: The user role setting 'Avoid indexing profile by search engines'
This commit is contained in:
@@ -40,6 +40,14 @@
|
|||||||
'label' => __( 'Can view/access private profiles?', 'ultimate-member' ),
|
'label' => __( 'Can view/access private profiles?', 'ultimate-member' ),
|
||||||
'tooltip' => __( 'Can this role view 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,
|
'value' => ! empty( $role['_um_can_access_private_profile'] ) ? $role['_um_can_access_private_profile'] : 0,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => '_um_profile_noindex',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'name' => '_um_profile_noindex',
|
||||||
|
'label' => __( 'Avoid indexing profile by search engines', 'ultimate-member' ),
|
||||||
|
'tooltip' => __( 'Hides the profile page for robots', 'ultimate-member' ),
|
||||||
|
'value' => ! empty( $role['_um_profile_noindex'] ) ? $role['_um_profile_noindex'] : 0,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) )->render_form(); ?>
|
) )->render_form(); ?>
|
||||||
|
|||||||
@@ -1139,7 +1139,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
|||||||
'required' => 0,
|
'required' => 0,
|
||||||
'public' => 1,
|
'public' => 1,
|
||||||
'editable' => 1,
|
'editable' => 1,
|
||||||
'default' => '0',
|
'default' => UM()->roles()->um_user_can( 'profile_noindex' ) ? '1' : '0',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'0' => __( 'No', 'ultimate-member' ),
|
'0' => __( 'No', 'ultimate-member' ),
|
||||||
'1' => __( 'Yes', 'ultimate-member' ),
|
'1' => __( 'Yes', 'ultimate-member' ),
|
||||||
|
|||||||
@@ -682,15 +682,27 @@ function um_profile_dynamic_meta_desc() {
|
|||||||
|
|
||||||
$privacy = get_user_meta( $user_id, 'profile_privacy', true );
|
$privacy = get_user_meta( $user_id, 'profile_privacy', true );
|
||||||
if ( $privacy == __( 'Only me', 'ultimate-member' ) || $privacy == 'Only me' ) {
|
if ( $privacy == __( 'Only me', 'ultimate-member' ) || $privacy == 'Only me' ) {
|
||||||
|
echo '<meta name="robots" content="noindex, nofollow" />';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see the user role setting "Avoid indexing profile by search engines"
|
||||||
|
*/
|
||||||
|
$role = UM()->roles()->get_priority_user_role( $user_id );
|
||||||
|
$permissions = UM()->roles()->role_data( $role );
|
||||||
|
if ( ! empty( $permissions['profile_noindex'] ) ) {
|
||||||
|
echo '<meta name="robots" content="noindex, nofollow" />';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see the account setting "Avoid indexing my profile by search engines"
|
||||||
|
*/
|
||||||
$noindex = get_user_meta( $user_id, 'profile_noindex', true );
|
$noindex = get_user_meta( $user_id, 'profile_noindex', true );
|
||||||
if ( ! empty( $noindex ) ) { ?>
|
if ( ! empty( $noindex ) ) {
|
||||||
|
echo '<meta name="robots" content="noindex, nofollow" />';
|
||||||
<meta name="robots" content="noindex, nofollow" />
|
return;
|
||||||
|
|
||||||
<?php return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
um_fetch_user( $user_id );
|
um_fetch_user( $user_id );
|
||||||
|
|||||||
Reference in New Issue
Block a user