- added profile privacy setting for the avoiding profile indexation;

This commit is contained in:
nikitasinelnikov
2020-06-19 13:07:04 +03:00
parent a41cad52e1
commit 02fde13b39
7 changed files with 70 additions and 22 deletions
+1 -1
View File
@@ -590,7 +590,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
case 'privacy':
$args = 'profile_privacy,hide_in_members';
$args = 'profile_privacy,profile_noindex,hide_in_members';
/**
* UM hook
*
+31 -12
View File
@@ -1115,18 +1115,37 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
// account page use ( not public )
'profile_privacy' => array(
'title' => __('Profile Privacy','ultimate-member'),
'metakey' => 'profile_privacy',
'type' => 'select',
'label' => __('Profile Privacy','ultimate-member'),
'help' => __('Who can see your public profile?','ultimate-member'),
'required' => 0,
'public' => 1,
'editable' => 1,
'default' => 'Everyone',
'options' => $profile_privacy,
'allowclear' => 0,
'account_only' => true,
'title' => __( 'Profile Privacy', 'ultimate-member' ),
'metakey' => 'profile_privacy',
'type' => 'select',
'label' => __( 'Profile Privacy', 'ultimate-member' ),
'help' => __( 'Who can see your public profile?', 'ultimate-member' ),
'required' => 0,
'public' => 1,
'editable' => 1,
'default' => 'Everyone',
'options' => $profile_privacy,
'allowclear' => 0,
'account_only' => true,
'required_perm' => 'can_make_private_profile',
),
'profile_noindex' => array(
'title' => __( 'Avoid my profile indexing', 'ultimate-member' ),
'metakey' => 'profile_noindex',
'type' => 'select',
'label' => __( 'Avoid my profile indexing', 'ultimate-member' ),
'help' => __( 'Hide my profile for robots?', 'ultimate-member' ),
'required' => 0,
'public' => 1,
'editable' => 1,
'default' => '0',
'options' => array(
'0' => __( 'No', 'ultimate-member' ),
'1' => __( 'Yes', 'ultimate-member' ),
),
'allowclear' => 0,
'account_only' => true,
'required_perm' => 'can_make_private_profile',
),
+20 -6
View File
@@ -629,6 +629,20 @@ function um_profile_dynamic_meta_desc() {
if ( um_is_core_page( 'user' ) && um_get_requested_user() ) {
$user_id = um_get_requested_user();
$privacy = get_user_meta( $user_id, 'profile_privacy', true );
if ( $privacy == __( 'Only me', 'ultimate-member' ) || $privacy == 'Only me' ) {
return;
}
$noindex = get_user_meta( $user_id, 'profile_noindex', true );
if ( ! empty( $noindex ) ) { ?>
<meta name="robots" content="noindex, nofollow" />
<?php return;
}
um_fetch_user( $user_id );
$locale = get_user_locale( $user_id );
@@ -647,12 +661,12 @@ function um_profile_dynamic_meta_desc() {
$image = um_get_user_avatar_url( $user_id, $size );
$person = array(
"@context" => "http://schema.org",
"@type" => "Person",
"name" => esc_attr( $title ),
"description" => esc_attr( $description ),
"image" => esc_url( $image ),
"url" => esc_url( $url )
"@context" => "http://schema.org",
"@type" => "Person",
"name" => esc_attr( $title ),
"description" => esc_attr( $description ),
"image" => esc_url( $image ),
"url" => esc_url( $url ),
);
um_reset_user();
+12
View File
@@ -16,6 +16,18 @@ function um_dynamic_user_profile_pagetitle( $title, $sep = '' ) {
if ( um_is_core_page( 'user' ) && um_get_requested_user() ) {
$user_id = um_get_requested_user();
$privacy = get_user_meta( $user_id, 'profile_privacy', true );
if ( $privacy == __( 'Only me', 'ultimate-member' ) || $privacy == 'Only me' ) {
return $title;
}
$noindex = get_user_meta( $user_id, 'profile_noindex', true );
if ( ! empty( $noindex ) ) {
return $title;
}
um_fetch_user( um_get_requested_user() );
$profile_title = um_convert_tags( $profile_title );
+1 -1
View File
@@ -2053,7 +2053,7 @@ function um_get_cover_uri( $image, $attrs ) {
function um_get_avatar_url( $get_avatar ) {
preg_match( '/src="(.*?)"/i', $get_avatar, $matches );
return $matches[1];
return isset( $matches[1] ) ? $matches[1] : '';
}
+1 -1
View File
@@ -142,7 +142,7 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
= Important: =
* To learn more about version 2.1 please see this [topic](https://wordpress.org/support/topic/version-2-1-4/)
* To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0)
* UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin
= 2.1.6: June 1, 2020 =
+4 -1
View File
@@ -2,7 +2,10 @@
<div id="um_view_photo" style="display:none">
<a href="javascript:void(0);" data-action="um_remove_modal" class="um-modal-close"><i class="um-faicon-times"></i></a>
<a href="javascript:void(0);" data-action="um_remove_modal" class="um-modal-close"
aria-label="<?php esc_attr_e( 'Close view photo modal', 'ultimate-member' ) ?>">
<i class="um-faicon-times"></i>
</a>
<div class="um-modal-body photo">
<div class="um-modal-photo"></div>