{{#if model.canViewProfile}}
{{#link-to 'user' model class="btn"}}
{{d-icon "user"}}
{{i18n 'admin.user.show_public_profile'}}
{{/link-to}}
{{/if}}
{{#if model.can_view_action_logs}}
{{d-button action="viewActionLogs" actionParam=model.username icon="list-alt" label="admin.user.action_logs"}}
{{/if}}
{{#if model.active}}
{{#if model.can_impersonate}}
{{d-button class="btn-danger" action="impersonate" icon="crosshairs" label="admin.impersonate.title" title="admin.impersonate.help"}}
{{/if}}
{{#if currentUser.admin}}
{{d-button action="logOut" icon="power-off" label="admin.user.log_out"}}
{{/if}}
{{/if}}
{{plugin-outlet name="admin-user-controls-after" args=(hash model=model) tagName="" connectorTagName=""}}
{{i18n 'user.username.title'}}
{{#if editingUsername}}
{{text-field value=userUsernameValue autofocus="autofocus"}}
{{else}}
{{model.username}}
{{/if}}
{{#if editingUsername}}
{{d-button action="saveUsername" label="admin.user_fields.save"}}
{{i18n 'cancel'}}
{{else}}
{{d-button action="toggleUsernameEdit" icon="pencil"}}
{{/if}}
{{i18n 'user.name.title'}}
{{#if editingName}}
{{text-field value=userNameValue autofocus="autofocus"}}
{{else}}
{{model.name}}
{{/if}}
{{#if editingName}}
{{d-button action="saveName" label="admin.user_fields.save"}}
{{i18n 'cancel'}}
{{else}}
{{d-button action="toggleNameEdit" icon="pencil"}}
{{/if}}
{{#if canCheckEmails}}
{{i18n 'user.email.title'}}
{{#unless model.active}}
{{i18n 'admin.users.not_verified'}}
{{/unless}}
{{#if model.email}}
{{model.email}}
{{else}}
{{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
{{/if}}
{{model.bounceScore}}
{{#if model.canResetBounceScore}}
{{d-button action="resetBounceScore" label="admin.user.reset_bounce_score.label" title="admin.user.reset_bounce_score.title"}}
{{/if}}
{{model.bounceScoreExplanation}}
{{i18n 'user.associated_accounts'}}
{{#if model.associated_accounts}}
{{model.associated_accounts}}
{{else}}
{{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
{{/if}}
{{/if}}
{{i18n 'user.avatar.title'}}
{{avatar content imageSize="large"}}
{{{i18n "admin.user.visit_profile" url=preferencesPath}}}
{{i18n 'user.title.title'}}
{{#if editingTitle}}
{{text-field value=userTitleValue autofocus="autofocus"}}
{{else}}
{{model.title}}
{{/if}}
{{#if editingTitle}}
{{d-button action="saveTitle" label="admin.user_fields.save"}}
{{i18n 'cancel'}}
{{else}}
{{d-button action="toggleTitleEdit" icon="pencil"}}
{{/if}}
{{i18n 'user.ip_address.title'}}
{{model.ip_address}}
{{#if currentUser.staff}}
{{d-button action="refreshBrowsers" label="admin.user.refresh_browsers"}}
{{ip-lookup ip=model.ip_address userId=model.id}}
{{/if}}
{{i18n 'user.registration_ip_address.title'}}
{{model.registration_ip_address}}
{{#if currentUser.staff}}
{{ip-lookup ip=model.registration_ip_address userId=model.id}}
{{/if}}
{{#if showBadges}}
{{i18n 'admin.badges.title'}}
{{i18n 'badges.badge_count' count=model.badge_count}}
{{#link-to 'adminUser.badges' model class="btn"}}{{d-icon "certificate"}}{{i18n 'admin.badges.edit_badges'}}{{/link-to}}
{{/if}}
{{#if userFields}}
{{i18n 'admin.user.permissions'}}
{{#if showApproval}}
{{i18n 'admin.users.approved'}}
{{#if model.approved}}
{{i18n 'admin.user.approved_by'}}
{{#link-to 'adminUser' approvedBy}}{{avatar model.approvedBy imageSize="small"}}{{/link-to}}
{{#link-to 'adminUser' approvedBy}}{{model.approvedBy.username}}{{/link-to}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
{{#if model.approved}}
{{i18n 'admin.user.approve_success'}}
{{else}}
{{#if model.can_approve}}
{{d-button action="approve" icon="check" label="admin.user.approve"}}
{{/if}}
{{/if}}
{{/if}}
{{i18n 'admin.users.active'}}
{{i18n-yes-no model.active}}
{{#if model.active}}
{{#if model.can_deactivate}}
{{d-button action="deactivate" label="admin.user.deactivate_account"}}
{{i18n 'admin.user.deactivate_explanation'}}
{{/if}}
{{else}}
{{#if model.can_send_activation_email}}
{{d-button action="sendActivationEmail" icon="envelope" label="admin.user.send_activation_email"}}
{{/if}}
{{#if model.can_activate}}
{{d-button action="activate" icon="check" label="admin.user.activate"}}
{{/if}}
{{/if}}
{{i18n 'admin.user.staged'}}
{{i18n-yes-no model.staged}}
{{i18n 'admin.user.staged_explanation'}}
{{#if currentUser.admin}}
{{i18n 'admin.api.key'}}
{{#if model.api_key}}
{{model.api_key.key}}
{{d-button action="regenerateApiKey" icon="undo" label="admin.api.regenerate"}}
{{d-button action="revokeApiKey" icon="times" label="admin.api.revoke"}}
{{else}}
—
{{d-button action="generateApiKey" icon="key" label="admin.api.generate"}}
{{/if}}
{{/if}}
{{i18n 'admin.user.admin'}}
{{i18n-yes-no model.admin}}
{{#if model.can_revoke_admin}}
{{d-button action="revokeAdmin" icon="shield" label="admin.user.revoke_admin"}}
{{/if}}
{{#if model.can_grant_admin}}
{{d-button action="grantAdmin" icon="shield" label="admin.user.grant_admin"}}
{{/if}}
{{i18n 'admin.user.moderator'}}
{{i18n-yes-no model.moderator}}
{{#if model.can_revoke_moderation}}
{{d-button action="revokeModeration" icon="shield" label="admin.user.revoke_moderation"}}
{{/if}}
{{#if model.can_grant_moderation}}
{{d-button action="grantModeration" icon="shield" label="admin.user.grant_moderation"}}
{{/if}}
{{i18n 'trust_level'}}
{{combo-box content=site.trustLevels value=model.trust_level nameProperty="detailedName"}}
{{#if model.dirty}}
{{d-button class="ok no-text" action="saveTrustLevel" icon="check"}}
{{d-button class="cancel no-text" action="restoreTrustLevel" icon="times"}}
{{/if}}
{{#if model.canLockTrustLevel}}
{{#if model.trust_level_locked}}
{{d-icon "lock" title="admin.user.trust_level_locked_tip"}}
{{d-button action="lockTrustLevel" actionParam=false label="admin.user.unlock_trust_level"}}
{{else}}
{{d-icon "unlock" title="admin.user.trust_level_unlocked_tip"}}
{{d-button action="lockTrustLevel" actionParam=true label="admin.user.lock_trust_level"}}
{{/if}}
{{/if}}
{{#if model.tl3Requirements}}
{{#link-to 'adminUser.tl3Requirements' model class="btn"}}{{i18n 'admin.user.trust_level_3_requirements'}}{{/link-to}}
{{/if}}
{{i18n 'admin.user.suspended'}}
{{i18n-yes-no model.isSuspended}}
{{#if model.isSuspended}}
{{#unless model.suspendedForever}}
{{i18n "admin.user.suspended_until" until=model.suspendedTillDate}}
{{/unless}}
{{/if}}
{{#if model.isSuspended}}
{{d-button
class="btn-danger unsuspend-user"
action=(action "unsuspend")
icon="ban"
label="admin.user.unsuspend"}}
{{i18n 'admin.user.suspended_explanation'}}
{{else}}
{{#if model.canSuspend}}
{{d-button
class="btn-danger suspend-user"
action=(action "showSuspendModal")
icon="ban"
label="admin.user.suspend"}}
{{i18n 'admin.user.suspended_explanation'}}
{{/if}}
{{/if}}
{{#if model.isSuspended}}
{{i18n 'admin.user.suspended_by'}}
{{#link-to 'adminUser' suspendedBy}}{{avatar model.suspendedBy imageSize="tiny"}}{{/link-to}}
{{#link-to 'adminUser' suspendedBy}}{{model.suspendedBy.username}}{{/link-to}}
{{i18n 'admin.user.suspend_reason'}}:
{{model.suspend_reason}}
{{/if}}
{{i18n 'admin.user.blocked'}}
{{i18n-yes-no model.blocked}}
{{#conditional-loading-spinner size="small" condition=model.blockingUser}}
{{#if model.blocked}}
{{d-button action="unblock" icon="thumbs-o-up" label="admin.user.unblock"}}
{{i18n 'admin.user.block_explanation'}}
{{else}}
{{d-button action="block" icon="ban" label="admin.user.block"}}
{{i18n 'admin.user.block_explanation'}}
{{/if}}
{{/conditional-loading-spinner}}
{{#if currentUser.admin}}
{{i18n 'admin.user.activity'}}
{{i18n 'created'}}
{{format-date model.created_at leaveAgo="true"}}
{{i18n 'admin.users.last_emailed'}}
{{format-date model.last_emailed_at leaveAgo="true"}}
{{i18n 'last_seen'}}
{{format-date model.last_seen_at leaveAgo="true"}}
{{i18n 'admin.user.like_count'}}
{{model.like_given_count}} / {{model.like_count}}
{{i18n 'admin.user.topics_entered'}}
{{model.topics_entered}}
{{i18n 'admin.user.post_count'}}
{{model.post_count}}
{{#if model.can_delete_all_posts}}
{{#if model.post_count}}
{{d-button class="btn-danger" action="deleteAllPosts" icon="trash-o" label="admin.user.delete_all_posts"}}
{{/if}}
{{else}}
{{model.deleteAllPostsExplanation}}
{{/if}}
{{i18n 'admin.user.posts_read_count'}}
{{model.posts_read_count}}
{{i18n 'admin.user.warnings_received_count'}}
{{model.warnings_received_count}}
{{i18n 'admin.user.flags_given_received_count'}}
{{model.flags_given_count}} / {{model.flags_received_count}}
{{i18n 'admin.user.private_topics_count'}}
{{model.private_topics_count}}
{{i18n 'admin.user.time_read'}}
{{{model.time_read}}}
{{i18n 'user.invited.days_visited'}}
{{{model.days_visited}}}
{{#if model.single_sign_on_record}}