Add isset checks to profile updates
Partial updates are not a thing, but just to be safe. This had already been an issue with post meta once.
This commit is contained in:
parent
44125dde10
commit
026176241d
@ -381,6 +381,7 @@ function fictioneer_admin_profile_fields_flags( $profile_user ) {
|
||||
<fieldset>
|
||||
<div>
|
||||
<label for="fictioneer_enforce_gravatar" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_enforce_gravatar" value="0">
|
||||
<input
|
||||
name="fictioneer_enforce_gravatar"
|
||||
type="checkbox"
|
||||
@ -393,6 +394,7 @@ function fictioneer_admin_profile_fields_flags( $profile_user ) {
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_disable_avatar" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_disable_avatar" value="0">
|
||||
<input
|
||||
name="fictioneer_disable_avatar"
|
||||
type="checkbox"
|
||||
@ -405,6 +407,7 @@ function fictioneer_admin_profile_fields_flags( $profile_user ) {
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_lock_avatar" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_lock_avatar" value="0">
|
||||
<input
|
||||
name="fictioneer_lock_avatar"
|
||||
type="checkbox"
|
||||
@ -418,6 +421,7 @@ function fictioneer_admin_profile_fields_flags( $profile_user ) {
|
||||
<?php if ( get_option( 'fictioneer_enable_custom_badges' ) ) : ?>
|
||||
<div class="profile__input-wrapper profile__input-wrapper--checkbox">
|
||||
<label for="fictioneer_hide_badge" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_hide_badge" value="0">
|
||||
<input
|
||||
name="fictioneer_hide_badge"
|
||||
type="checkbox"
|
||||
@ -431,6 +435,7 @@ function fictioneer_admin_profile_fields_flags( $profile_user ) {
|
||||
<?php if ( ! empty( get_the_author_meta( 'fictioneer_badge_override', $profile_user->ID ) ) ) : ?>
|
||||
<div class="profile__input-wrapper profile__input-wrapper--checkbox">
|
||||
<label for="fictioneer_disable_badge_override" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_disable_badge_override" value="0">
|
||||
<input
|
||||
name="fictioneer_disable_badge_override"
|
||||
type="checkbox"
|
||||
@ -446,6 +451,7 @@ function fictioneer_admin_profile_fields_flags( $profile_user ) {
|
||||
<?php if ( get_option( 'fictioneer_enable_comment_notifications' ) ) : ?>
|
||||
<div class="profile__input-wrapper profile__input-wrapper--checkbox">
|
||||
<label for="fictioneer_comment_reply_notifications" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_comment_reply_notifications" value="0">
|
||||
<input
|
||||
name="fictioneer_comment_reply_notifications"
|
||||
type="checkbox"
|
||||
@ -756,48 +762,56 @@ function fictioneer_admin_profile_moderation( $profile_user ) {
|
||||
<fieldset>
|
||||
<div>
|
||||
<label for="fictioneer_admin_disable_avatar" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_admin_disable_avatar" value="0">
|
||||
<input name="fictioneer_admin_disable_avatar" type="checkbox" id="fictioneer_admin_disable_avatar" <?php echo checked( 1, get_the_author_meta( 'fictioneer_admin_disable_avatar', $profile_user->ID ), false ); ?> value="1">
|
||||
<span><?php _e( 'Disable user avatar', 'fictioneer' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_admin_disable_reporting" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_admin_disable_reporting" value="0">
|
||||
<input name="fictioneer_admin_disable_reporting" type="checkbox" id="fictioneer_admin_disable_reporting" <?php echo checked( 1, get_the_author_meta( 'fictioneer_admin_disable_reporting', $profile_user->ID ), false ); ?> value="1">
|
||||
<span><?php _e( 'Disable reporting capability', 'fictioneer' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_admin_disable_renaming" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_admin_disable_renaming" value="0">
|
||||
<input name="fictioneer_admin_disable_renaming" type="checkbox" id="fictioneer_admin_disable_renaming" <?php echo checked( 1, get_the_author_meta( 'fictioneer_admin_disable_renaming', $profile_user->ID ), false ); ?> value="1">
|
||||
<span><?php _e( 'Disable renaming capability', 'fictioneer' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_admin_disable_commenting" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_admin_disable_commenting" value="0">
|
||||
<input name="fictioneer_admin_disable_commenting" type="checkbox" id="fictioneer_admin_disable_commenting" <?php echo checked( 1, get_the_author_meta( 'fictioneer_admin_disable_commenting', $profile_user->ID ), false ); ?> value="1">
|
||||
<span><?php _e( 'Disable commenting capability', 'fictioneer' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_admin_disable_comment_editing" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_admin_disable_comment_editing" value="0">
|
||||
<input name="fictioneer_admin_disable_comment_editing" type="checkbox" id="fictioneer_admin_disable_comment_editing" <?php echo checked( 1, get_the_author_meta( 'fictioneer_admin_disable_comment_editing', $profile_user->ID ), false ); ?> value="1">
|
||||
<span><?php _e( 'Disable comment editing capability', 'fictioneer' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_admin_disable_post_comment_moderation" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_admin_disable_post_comment_moderation" value="0">
|
||||
<input name="fictioneer_admin_disable_post_comment_moderation" type="checkbox" id="fictioneer_admin_disable_post_comment_moderation" <?php echo checked( 1, get_the_author_meta( 'fictioneer_admin_disable_post_comment_moderation', $profile_user->ID ), false ); ?> value="1">
|
||||
<span><?php _e( 'Disable post comment moderation capability', 'fictioneer' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_admin_disable_comment_notifications" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_admin_disable_comment_notifications" value="0">
|
||||
<input name="fictioneer_admin_disable_comment_notifications" type="checkbox" id="fictioneer_admin_disable_comment_notifications" <?php echo checked( 1, get_the_author_meta( 'fictioneer_admin_disable_comment_notifications', $profile_user->ID ), false ); ?> value="1">
|
||||
<span><?php _e( 'Disable comment reply notifications', 'fictioneer' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="fictioneer_admin_always_moderate_comments" class="checkbox-group">
|
||||
<input type="hidden" name="fictioneer_admin_always_moderate_comments" value="0">
|
||||
<input name="fictioneer_admin_always_moderate_comments" type="checkbox" id="fictioneer_admin_always_moderate_comments" <?php echo checked( 1, get_the_author_meta( 'fictioneer_admin_always_moderate_comments', $profile_user->ID ), false ); ?> value="1">
|
||||
<span><?php _e( 'Always hold comments for moderation', 'fictioneer' ); ?></span>
|
||||
</label>
|
||||
|
@ -49,67 +49,85 @@ function fictioneer_update_admin_user_profile( $updated_user_id ) {
|
||||
// Moderation flags...
|
||||
if ( ( $sender_is_moderator || $sender_is_admin ) && ! $admin_protection ) {
|
||||
// Disable avatar checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_avatar',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_avatar'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_disable_avatar'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_avatar',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_avatar'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Disable reporting capability checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_reporting',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_reporting'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_disable_reporting'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_reporting',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_reporting'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Disable renaming capability checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_renaming',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_renaming'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_disable_renaming'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_renaming',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_renaming'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Disable commenting capability checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_commenting',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_commenting'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_disable_commenting'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_commenting',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_commenting'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Disable comment editing capability checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_comment_editing',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_comment_editing'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_disable_comment_editing'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_comment_editing',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_comment_editing'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Disable post comment moderation capability checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_post_comment_moderation',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_post_comment_moderation'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_disable_post_comment_moderation'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_post_comment_moderation',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_post_comment_moderation'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Disable comment notification capability checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_comment_notifications',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_comment_notifications'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_disable_comment_notifications'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_disable_comment_notifications',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_disable_comment_notifications'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Always hold comments for moderation
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_always_moderate_comments',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_always_moderate_comments'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_always_moderate_comments'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_always_moderate_comments',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_admin_always_moderate_comments'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Custom moderation message shown in profile
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_moderation_message',
|
||||
sanitize_text_field( $_POST['fictioneer_admin_moderation_message'] ?? '' )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_admin_moderation_message'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_admin_moderation_message',
|
||||
sanitize_text_field( $_POST['fictioneer_admin_moderation_message'] ?? '' )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Account fields...
|
||||
@ -190,110 +208,136 @@ function fictioneer_update_my_user_profile( $updated_user_id ) {
|
||||
// Profile flags...
|
||||
if ( $sender_is_owner || $sender_is_admin ) {
|
||||
// Enforce gravatar checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_enforce_gravatar',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_enforce_gravatar'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_enforce_gravatar'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_enforce_gravatar',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_enforce_gravatar'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Disable avatar checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_disable_avatar',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_disable_avatar'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_disable_avatar'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_disable_avatar',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_disable_avatar'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Lock avatar checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_lock_avatar',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_lock_avatar'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_lock_avatar'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_lock_avatar',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_lock_avatar'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Hide badge checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_hide_badge',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_hide_badge'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_hide_badge'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_hide_badge',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_hide_badge'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Disable badge override checkbox
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_disable_badge_override',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_disable_badge_override'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_disable_badge_override'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_disable_badge_override',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_disable_badge_override'] ?? 0 )
|
||||
);
|
||||
}
|
||||
|
||||
// Always subscribe to reply email notifications
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_comment_reply_notifications',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_comment_reply_notifications'] ?? 0 )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_comment_reply_notifications'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_comment_reply_notifications',
|
||||
fictioneer_sanitize_checkbox( $_POST['fictioneer_comment_reply_notifications'] ?? 0 )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Author fields (if author)...
|
||||
if ( fictioneer_is_author( $updated_user_id ) || $sender_is_admin ) {
|
||||
// Selected author page (if any)
|
||||
if ( intval( $_POST['fictioneer_author_page'] ?? 0 ) > 0 ) {
|
||||
// Get ID and make sure it belongs to a page
|
||||
$author_page_id = intval( $_POST['fictioneer_author_page'] );
|
||||
$author_page_id = get_post_type( $author_page_id ) == 'page' ? $author_page_id : -1;
|
||||
if ( isset( $_POST['fictioneer_author_page'] ) ) {
|
||||
if ( intval( $_POST['fictioneer_author_page'] ?? 0 ) > 0 ) {
|
||||
// Get ID and make sure it belongs to a page
|
||||
$author_page_id = intval( $_POST['fictioneer_author_page'] );
|
||||
$author_page_id = get_post_type( $author_page_id ) == 'page' ? $author_page_id : -1;
|
||||
|
||||
// Make sure the page belongs to the author
|
||||
if ( $author_page_id > 0 ) {
|
||||
$author_page = get_post( $author_page_id );
|
||||
$author_page_id = $author_page && intval( $author_page->post_author ) == $updated_user_id ? $author_page_id : -1;
|
||||
// Make sure the page belongs to the author
|
||||
if ( $author_page_id > 0 ) {
|
||||
$author_page = get_post( $author_page_id );
|
||||
$author_page_id = $author_page && intval( $author_page->post_author ) == $updated_user_id ? $author_page_id : -1;
|
||||
}
|
||||
|
||||
// Update
|
||||
update_user_meta( $updated_user_id, 'fictioneer_author_page', $author_page_id );
|
||||
} else {
|
||||
// Delete
|
||||
delete_user_meta( $updated_user_id, 'fictioneer_author_page' );
|
||||
}
|
||||
|
||||
// Update
|
||||
update_user_meta( $updated_user_id, 'fictioneer_author_page', $author_page_id );
|
||||
} else {
|
||||
// Delete
|
||||
delete_user_meta( $updated_user_id, 'fictioneer_author_page' );
|
||||
}
|
||||
|
||||
// Patreon link (if any)
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_patreon_link',
|
||||
sanitize_url( $_POST['fictioneer_user_patreon_link'] ?? '' )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_user_patreon_link'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_patreon_link',
|
||||
sanitize_url( $_POST['fictioneer_user_patreon_link'] ?? '' )
|
||||
);
|
||||
}
|
||||
|
||||
// Ko-Fi link (if any)
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_kofi_link',
|
||||
sanitize_url( $_POST['fictioneer_user_kofi_link'] ?? '' )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_user_kofi_link'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_kofi_link',
|
||||
sanitize_url( $_POST['fictioneer_user_kofi_link'] ?? '' )
|
||||
);
|
||||
}
|
||||
|
||||
// SubscribeStar link (if any)
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_subscribestar_link',
|
||||
sanitize_url( $_POST['fictioneer_user_subscribestar_link'] ?? '' )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_user_subscribestar_link'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_subscribestar_link',
|
||||
sanitize_url( $_POST['fictioneer_user_subscribestar_link'] ?? '' )
|
||||
);
|
||||
}
|
||||
|
||||
// PayPal link (if any)
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_paypal_link',
|
||||
sanitize_url( $_POST['fictioneer_user_paypal_link'] ?? '' )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_user_paypal_link'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_paypal_link',
|
||||
sanitize_url( $_POST['fictioneer_user_paypal_link'] ?? '' )
|
||||
);
|
||||
}
|
||||
|
||||
// Donation link (if any)
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_donation_link',
|
||||
sanitize_url( $_POST['fictioneer_user_donation_link'] ?? '' )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_user_donation_link'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_user_donation_link',
|
||||
sanitize_url( $_POST['fictioneer_user_donation_link'] ?? '' )
|
||||
);
|
||||
}
|
||||
|
||||
// Support message (if any)
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_support_message',
|
||||
sanitize_text_field( $_POST['fictioneer_support_message'] ?? '' )
|
||||
);
|
||||
if ( isset( $_POST['fictioneer_support_message'] ) ) {
|
||||
fictioneer_update_user_meta(
|
||||
$updated_user_id,
|
||||
'fictioneer_support_message',
|
||||
sanitize_text_field( $_POST['fictioneer_support_message'] ?? '' )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'personal_options_update', 'fictioneer_update_my_user_profile' );
|
||||
@ -343,28 +387,40 @@ function fictioneer_update_frontend_profile() {
|
||||
}
|
||||
|
||||
// Hide custom badge?
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_hide_badge'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_hide_badge', $checkbox_value );
|
||||
if ( isset( $_POST['fictioneer_hide_badge'] ) ) {
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_hide_badge'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_hide_badge', $checkbox_value );
|
||||
}
|
||||
|
||||
// Always use gravatar?
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_enforce_gravatar'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_enforce_gravatar', $checkbox_value );
|
||||
if ( isset( $_POST['fictioneer_enforce_gravatar'] ) ) {
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_enforce_gravatar'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_enforce_gravatar', $checkbox_value );
|
||||
}
|
||||
|
||||
// Disable avatar?
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_disable_avatar'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_disable_avatar', $checkbox_value );
|
||||
if ( isset( $_POST['fictioneer_disable_avatar'] ) ) {
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_disable_avatar'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_disable_avatar', $checkbox_value );
|
||||
}
|
||||
|
||||
// Lock avatar?
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_lock_avatar'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_lock_avatar', $checkbox_value );
|
||||
if ( isset( $_POST['fictioneer_lock_avatar'] ) ) {
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_lock_avatar'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_lock_avatar', $checkbox_value );
|
||||
}
|
||||
|
||||
// Override assigned badge?
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_disable_badge_override'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_disable_badge_override', $checkbox_value );
|
||||
if ( isset( $_POST['fictioneer_disable_badge_override'] ) ) {
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_disable_badge_override'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_disable_badge_override', $checkbox_value );
|
||||
}
|
||||
|
||||
// Always subscribe to comments?
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_comment_reply_notifications'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_comment_reply_notifications', $checkbox_value );
|
||||
if ( isset( $_POST['fictioneer_comment_reply_notifications'] ) ) {
|
||||
$checkbox_value = fictioneer_sanitize_checkbox( $_POST['fictioneer_comment_reply_notifications'] ?? 0 );
|
||||
fictioneer_update_user_meta( $user_id, 'fictioneer_comment_reply_notifications', $checkbox_value );
|
||||
}
|
||||
|
||||
// Redirect
|
||||
wp_safe_redirect(
|
||||
|
@ -125,6 +125,7 @@ $renaming_disabled = $current_user->fictioneer_admin_disable_renaming;
|
||||
<div class="profile__flags">
|
||||
|
||||
<div class="profile__input-wrapper _checkbox" title="<?php esc_attr_e( 'Ignore site avatar and always pull from the Gravatar service.', 'fictioneer' ); ?>">
|
||||
<input type="hidden" name="fictioneer_enforce_gravatar" value="0">
|
||||
<input
|
||||
id="fictioneer_enforce_gravatar"
|
||||
name="fictioneer_enforce_gravatar"
|
||||
@ -136,6 +137,7 @@ $renaming_disabled = $current_user->fictioneer_admin_disable_renaming;
|
||||
</div>
|
||||
|
||||
<div class="profile__input-wrapper _checkbox" title="<?php esc_attr_e( 'Hide your avatar.', 'fictioneer' ); ?>">
|
||||
<input type="hidden" name="fictioneer_disable_avatar" value="0">
|
||||
<input
|
||||
id="fictioneer_disable_avatar"
|
||||
name="fictioneer_disable_avatar"
|
||||
@ -147,6 +149,7 @@ $renaming_disabled = $current_user->fictioneer_admin_disable_renaming;
|
||||
</div>
|
||||
|
||||
<div class="profile__input-wrapper _checkbox" title="<?php esc_attr_e( 'Prevent avatar from being overwritten with the latest OAuth account login.', 'fictioneer' ); ?>">
|
||||
<input type="hidden" name="fictioneer_lock_avatar" value="0">
|
||||
<input
|
||||
id="fictioneer_lock_avatar"
|
||||
name="fictioneer_lock_avatar"
|
||||
@ -160,6 +163,7 @@ $renaming_disabled = $current_user->fictioneer_admin_disable_renaming;
|
||||
<?php if ( get_option( 'fictioneer_enable_custom_badges' ) ) : ?>
|
||||
|
||||
<div class="profile__input-wrapper _checkbox" title="<?php esc_attr_e( 'Hide your badge on comments.', 'fictioneer' ); ?>">
|
||||
<input type="hidden" name="fictioneer_hide_badge" value="0">
|
||||
<input
|
||||
id="fictioneer_hide_badge"
|
||||
name="fictioneer_hide_badge"
|
||||
@ -172,6 +176,7 @@ $renaming_disabled = $current_user->fictioneer_admin_disable_renaming;
|
||||
|
||||
<?php if ( ! empty( get_the_author_meta( 'fictioneer_badge_override', $current_user->ID ) ) ) : ?>
|
||||
<div class="profile__input-wrapper _checkbox" title="<?php esc_attr_e( 'Disable custom badge overrides set by administrators.', 'fictioneer' ); ?>">
|
||||
<input type="hidden" name="fictioneer_disable_badge_override" value="0">
|
||||
<input
|
||||
id="fictioneer_disable_badge_override"
|
||||
name="fictioneer_disable_badge_override"
|
||||
@ -187,6 +192,7 @@ $renaming_disabled = $current_user->fictioneer_admin_disable_renaming;
|
||||
|
||||
<?php if ( get_option( 'fictioneer_enable_comment_notifications' ) ) : ?>
|
||||
<div class="profile__input-wrapper _checkbox" title="<?php esc_attr_e( 'Toggle the subscription checkbox on comments by default.', 'fictioneer' ); ?>">
|
||||
<input type="hidden" name="fictioneer_comment_reply_notifications" value="0">
|
||||
<input
|
||||
id="fictioneer_comment_reply_notifications"
|
||||
name="fictioneer_comment_reply_notifications"
|
||||
|
Loading…
x
Reference in New Issue
Block a user