2023-01-21 01:31:34 +01:00
< ? php
/**
* Partial : Account - Profile
*
* @ package WordPress
* @ subpackage Fictioneer
2024-01-26 17:45:59 +01:00
* @ since 5.0 . 0
2023-01-21 01:31:34 +01:00
*
2023-08-19 22:22:56 +02:00
* @ internal $args [ 'user' ] Current user .
* @ internal $args [ 'is_admin' ] True if the user is an administrator .
* @ internal $args [ 'is_author' ] True if the user is an author ( by capabilities ) .
* @ internal $args [ 'is_editor' ] True if the user is an editor .
* @ internal $args [ 'is_moderator' ] True if the user is a moderator ( by capabilities ) .
2023-01-21 01:31:34 +01:00
*/
2023-08-20 20:21:48 +02:00
// No direct access!
defined ( 'ABSPATH' ) OR exit ;
2023-01-21 01:31:34 +01:00
// Setup
$current_user = $args [ 'user' ];
$fingerprint = fictioneer_get_user_fingerprint ( $current_user -> ID );
$new_email = get_user_meta ( $current_user -> ID , '_new_email' , true );
2023-06-05 22:47:55 +02:00
$submit_url = admin_url ( 'admin-post.php?action=fictioneer_update_frontend_profile' );
2023-06-03 04:15:26 +02:00
$email_change_cancel_url = wp_nonce_url (
2023-06-05 22:47:55 +02:00
admin_url ( 'admin-post.php?action=fictioneer_cancel_frontend_email_change' ),
'fictioneer_cancel_frontend_email_change' ,
2023-06-03 04:15:26 +02:00
'fictioneer_nonce'
);
2023-01-21 01:31:34 +01:00
// Flags
$renaming_disabled = $current_user -> fictioneer_admin_disable_renaming ;
?>
2023-09-16 14:25:26 +02:00
< h3 id = " profile " class = " profile__account-headline " >< ? php _e ( 'Profile' , 'fictioneer' ); ?> </h3>
2023-01-21 01:31:34 +01:00
2023-06-03 04:15:26 +02:00
< form method = " post " action = " <?php echo esc_url( $submit_url ); ?> " class = " profile__account profile__segment " >
2023-01-21 01:31:34 +01:00
< div class = " profile__identity " >
< div class = " profile__input-group " >
2023-09-20 00:35:25 +02:00
< div class = " profile__input-label " >< ? php
printf (
_x ( 'Username (ID: %s)' , 'Username profile label with user ID.' , 'fictioneer' ),
$current_user -> ID
);
?> </div>
2023-01-21 01:31:34 +01:00
< div class = " profile__input-wrapper " >
2023-06-03 04:15:26 +02:00
< input
type = " text "
value = " <?php echo esc_attr( $current_user->user_login ); ?> "
class = " profile__input-field profile__nickname "
disabled
>
< p class = " profile__input-note " >< ? php _e ( 'Your unique name in the system. Cannot be changed.' , 'fictioneer' ); ?> </p>
2023-01-21 01:31:34 +01:00
</ div >
</ div >
< div class = " profile__input-group " >
2023-06-03 04:15:26 +02:00
< div class = " profile__input-label " >< ? php _e ( 'Fingerprint' , 'fictioneer' ); ?> </div>
2023-01-21 01:31:34 +01:00
< div class = " profile__input-wrapper " >
2023-06-03 04:15:26 +02:00
< input
type = " text "
value = " <?php echo esc_attr( $fingerprint ); ?> "
class = " profile__input-field profile__fingerprint "
disabled
>
< p class = " profile__input-note " >< ? php _e ( 'Your unique hash. Used to distinguish commenters.' , 'fictioneer' ); ?> </p>
2023-01-21 01:31:34 +01:00
</ div >
</ div >
< div class = " profile__input-group " >
2023-06-03 04:15:26 +02:00
< div class = " profile__input-label " >< ? php _e ( 'Nickname' , 'fictioneer' ); ?> </div>
2023-01-21 01:31:34 +01:00
< div class = " profile__input-wrapper " >
2023-06-03 04:15:26 +02:00
< input
name = " nickname "
type = " text "
value = " <?php echo esc_attr( $current_user->nickname ); ?> "
class = " profile__input-field profile__nickname "
< ? php if ( $renaming_disabled ) echo 'disabled' ; ?>
>
2023-11-21 23:40:08 +01:00
< p class = " profile__input-note " >< ? php _e ( 'Your nickname will be displayed instead of your username. Not unique!' , 'fictioneer' ); ?> </p>
2023-01-21 01:31:34 +01:00
</ div >
</ div >
2023-06-03 04:15:26 +02:00
< ? php if ( $renaming_disabled ) : ?>
< ul class = " profile__admin-notes " >
< li >
< i class = " fa-solid fa-bolt " ></ i >
< span >< ? php _e ( 'Renaming capability disabled.' , 'fictioneer' ); ?> </span>
</ li >
</ ul >
< ? php endif ; ?>
2023-01-21 01:31:34 +01:00
< div class = " profile__input-group " >
2023-06-03 04:15:26 +02:00
< div class = " profile__input-label " >< ? php _e ( 'Email Address' , 'fictioneer' ); ?> </div>
2023-01-21 01:31:34 +01:00
< div class = " profile__input-wrapper " >
2023-06-03 04:15:26 +02:00
< input
name = " email "
type = " text "
value = " <?php echo esc_attr( $current_user->user_email ); ?> "
class = " profile__input-field profile__email "
>
2023-01-21 01:31:34 +01:00
< ? php if ( $new_email && $new_email [ 'newemail' ] !== $current_user -> user_email ) : ?>
< p class = " profile__input-note " >
< ? php
printf (
2023-06-03 04:15:26 +02:00
__ ( 'Update to <strong>%1$s</strong> pending. Please check your previous email address to confirm. <a href="%2$s">Cancel.</a>' , 'fictioneer' ),
2023-01-21 01:31:34 +01:00
$new_email [ 'newemail' ],
2023-06-03 04:15:26 +02:00
esc_url ( $email_change_cancel_url )
);
2023-01-21 01:31:34 +01:00
?>
</ p >
< ? php else : ?>
2023-06-03 04:15:26 +02:00
< p class = " profile__input-note " >< ? php _e ( 'Changed email addresses will not become active until confirmed.' , 'fictioneer' ); ?> </p>
2023-01-21 01:31:34 +01:00
< ? php endif ; ?>
</ div >
</ div >
</ div >
< div class = " profile__flags " >
2024-01-12 11:15:23 +01:00
< div class = " profile__input-wrapper _checkbox " title = " <?php esc_attr_e( 'Ignore site avatar and always pull from the Gravatar service.', 'fictioneer' ); ?> " >
2024-01-12 13:27:45 +01:00
< input type = " hidden " name = " fictioneer_enforce_gravatar " value = " 0 " >
2023-06-03 04:15:26 +02:00
< input
id = " fictioneer_enforce_gravatar "
name = " fictioneer_enforce_gravatar "
type = " checkbox "
value = " 1 "
< ? php echo checked ( 1 , get_the_author_meta ( 'fictioneer_enforce_gravatar' , $current_user -> ID ), false ); ?>
>
< label for = " fictioneer_enforce_gravatar " >< ? php _e ( 'Always use gravatar' , 'fictioneer' ); ?> </label>
2023-01-21 01:31:34 +01:00
</ div >
2024-01-12 11:15:23 +01:00
< div class = " profile__input-wrapper _checkbox " title = " <?php esc_attr_e( 'Hide your avatar.', 'fictioneer' ); ?> " >
2024-01-12 13:27:45 +01:00
< input type = " hidden " name = " fictioneer_disable_avatar " value = " 0 " >
2023-06-03 04:15:26 +02:00
< input
id = " fictioneer_disable_avatar "
name = " fictioneer_disable_avatar "
type = " checkbox "
value = " 1 "
< ? php echo checked ( 1 , get_the_author_meta ( 'fictioneer_disable_avatar' , $current_user -> ID ), false ); ?>
>
< label for = " fictioneer_disable_avatar " >< ? php _e ( 'Disable avatar' , 'fictioneer' ); ?> </label>
2023-01-21 01:31:34 +01:00
</ div >
2024-01-12 11:15:23 +01:00
< div class = " profile__input-wrapper _checkbox " title = " <?php esc_attr_e( 'Prevent avatar from being overwritten with the latest OAuth account login.', 'fictioneer' ); ?> " >
2024-01-12 13:27:45 +01:00
< input type = " hidden " name = " fictioneer_lock_avatar " value = " 0 " >
2024-01-12 11:15:23 +01:00
< input
id = " fictioneer_lock_avatar "
name = " fictioneer_lock_avatar "
type = " checkbox "
value = " 1 "
< ? php echo checked ( 1 , get_the_author_meta ( 'fictioneer_lock_avatar' , $current_user -> ID ), false ); ?>
>
< label for = " fictioneer_lock_avatar " >< ? php _e ( 'Lock avatar' , 'fictioneer' ); ?> </label>
</ div >
2023-01-21 01:31:34 +01:00
< ? php if ( get_option ( 'fictioneer_enable_custom_badges' ) ) : ?>
2024-01-12 11:15:23 +01:00
< div class = " profile__input-wrapper _checkbox " title = " <?php esc_attr_e( 'Hide your badge on comments.', 'fictioneer' ); ?> " >
2024-01-12 13:27:45 +01:00
< input type = " hidden " name = " fictioneer_hide_badge " value = " 0 " >
2023-06-03 04:15:26 +02:00
< input
id = " fictioneer_hide_badge "
name = " fictioneer_hide_badge "
type = " checkbox "
value = " 1 "
< ? php echo checked ( 1 , get_the_author_meta ( 'fictioneer_hide_badge' , $current_user -> ID ), false ); ?>
>
< label for = " fictioneer_hide_badge " >< ? php _e ( 'Hide badge' , 'fictioneer' ); ?> </label>
2023-01-21 01:31:34 +01:00
</ div >
< ? php if ( ! empty ( get_the_author_meta ( 'fictioneer_badge_override' , $current_user -> ID ) ) ) : ?>
2024-01-12 11:15:23 +01:00
< div class = " profile__input-wrapper _checkbox " title = " <?php esc_attr_e( 'Disable custom badge overrides set by administrators.', 'fictioneer' ); ?> " >
2024-01-12 13:27:45 +01:00
< input type = " hidden " name = " fictioneer_disable_badge_override " value = " 0 " >
2023-06-03 04:15:26 +02:00
< input
id = " fictioneer_disable_badge_override "
name = " fictioneer_disable_badge_override "
type = " checkbox "
value = " 1 "
< ? php echo checked ( 1 , get_the_author_meta ( 'fictioneer_disable_badge_override' , $current_user -> ID ), false ); ?>
>
< label for = " fictioneer_disable_badge_override " >< ? php _e ( 'Override assigned badge' , 'fictioneer' ); ?> </label>
2023-01-21 01:31:34 +01:00
</ div >
< ? php endif ; ?>
< ? php endif ; ?>
< ? php if ( get_option ( 'fictioneer_enable_comment_notifications' ) ) : ?>
2024-01-12 11:15:23 +01:00
< div class = " profile__input-wrapper _checkbox " title = " <?php esc_attr_e( 'Toggle the subscription checkbox on comments by default.', 'fictioneer' ); ?> " >
2024-01-12 13:27:45 +01:00
< input type = " hidden " name = " fictioneer_comment_reply_notifications " value = " 0 " >
2023-06-03 04:15:26 +02:00
< input
id = " fictioneer_comment_reply_notifications "
name = " fictioneer_comment_reply_notifications "
type = " checkbox "
value = " 1 "
< ? php echo checked ( 1 , get_the_author_meta ( 'fictioneer_comment_reply_notifications' , $current_user -> ID ), false ); ?>
>
< label for = " fictioneer_comment_reply_notifications " >< ? php _e ( 'Always subscribe to comments' , 'fictioneer' ); ?> </label>
2023-01-21 01:31:34 +01:00
</ div >
< ? php endif ; ?>
</ div >
2023-06-05 22:47:55 +02:00
< ? php wp_nonce_field ( 'fictioneer_update_frontend_profile' , 'fictioneer_nonce' ); ?>
2023-01-21 01:31:34 +01:00
2023-06-03 04:15:26 +02:00
< input name = " user_id " type = " hidden " value = " <?php echo $current_user->ID ; ?> " >
2023-01-21 01:31:34 +01:00
< div class = " profile__actions " >
2025-01-08 18:59:34 +01:00
< input name = " submit " type = " submit " value = " <?php esc_attr_e( 'Update Profile', 'fictioneer' ); ?> " class = " button " data - fictioneer - target = " dcjProtected " disabled >
2023-01-21 01:31:34 +01:00
</ div >
</ form >