Updated user not found page.
This commit is contained in:
parent
a2ae5e3d15
commit
712979ba89
5 changed files with 179 additions and 169 deletions
|
@ -7,9 +7,9 @@ $isEditing = !empty($_GET['edit']) && is_string($_GET['edit']) ? (bool)$_GET['ed
|
|||
|
||||
$userId = user_find_for_profile($userId);
|
||||
|
||||
if ($userId < 1) {
|
||||
if($userId < 1) {
|
||||
http_response_code(404);
|
||||
echo tpl_render('user.notfound');
|
||||
echo tpl_render('profile.index');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,25 +28,34 @@
|
|||
</div>
|
||||
|
||||
<div class="profile__header__details__content">
|
||||
<div class="profile__header__username" style="{{ profile.user_colour|html_colour }}">
|
||||
{{ profile.username }}
|
||||
</div>
|
||||
{% if profile is defined %}
|
||||
<div class="profile__header__username" style="{{ profile.user_colour|html_colour }}">
|
||||
{{ profile.username }}
|
||||
</div>
|
||||
|
||||
{% if profile.user_title is not empty %}
|
||||
{% if profile.user_title is not empty %}
|
||||
<div class="profile__header__title">
|
||||
{{ profile.user_title }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="profile__header__country">
|
||||
<div class="flag flag--{{ profile.user_country|lower }}"></div>
|
||||
<div class="profile__header__country__name">
|
||||
{{ profile.user_country|country_name }}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="profile__header__username">
|
||||
User not found!
|
||||
</div>
|
||||
<div class="profile__header__title">
|
||||
{{ profile.user_title }}
|
||||
Check the link and try again.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="profile__header__country">
|
||||
<div class="flag flag--{{ profile.user_country|lower }}"></div>
|
||||
<div class="profile__header__country__name">
|
||||
{{ profile.user_country|country_name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if profile_relation_info|length > 0 and (profile_relation_info.subject_relation is not null or profile_relation_info.user_relation is not null) %}
|
||||
{% if profile is defined and profile_relation_info|length > 0 and (profile_relation_info.subject_relation is not null or profile_relation_info.user_relation is not null) %}
|
||||
<div class="profile__header__details__relation" title="Since {{ profile_relation_info.relation_created|date('r') }}">
|
||||
{% if profile_relation_info.subject_relation and profile_relation_info.user_relation %}
|
||||
Mutual Friends
|
||||
|
@ -60,27 +69,29 @@
|
|||
</div>
|
||||
|
||||
<div class="profile__header__options">
|
||||
<div class="profile__header__actions">
|
||||
{% if profile_mode is empty %}
|
||||
{% if profile_is_editing %}
|
||||
<button class="input__button input__button--save profile__header__action">Save</button>
|
||||
<a href="{{ url('user-profile', {'user': profile.user_id}) }}" class="input__button input__button--destroy profile__header__action">Discard</a>
|
||||
<a href="{{ url('settings-index') }}" class="input__button profile__header__action">Settings</a>
|
||||
{% elseif profile_can_edit %}
|
||||
<a href="{{ url('user-profile-edit', {'user': profile.user_id}) }}" class="input__button profile__header__action">Edit Profile</a>
|
||||
{% endif %}
|
||||
|
||||
{% if current_user is defined and current_user.user_id != profile.user_id and not profile_is_editing %}
|
||||
{% if profile_relation_info.user_relation == constant('MSZ_USER_RELATION_FOLLOW') %}
|
||||
<a href="{{ url('user-relation-none', {'user': profile.user_id}) }}" class="input__button input__button--destroy profile__header__action js-user-relation-action" data-relation-user="{{ profile.user_id }}" data-relation-type="{{ constant('MSZ_USER_RELATION_NONE') }}">Unfollow</a>
|
||||
{% else %}
|
||||
<a href="{{ url('user-relation-follow', {'user': profile.user_id}) }}" class="input__button profile__header__action js-user-relation-action" data-relation-user="{{ profile.user_id }}" data-relation-type="{{ constant('MSZ_USER_RELATION_FOLLOW') }}">Follow</a>
|
||||
{% if profile is defined %}
|
||||
<div class="profile__header__actions">
|
||||
{% if profile_mode is empty %}
|
||||
{% if profile_is_editing %}
|
||||
<button class="input__button input__button--save profile__header__action">Save</button>
|
||||
<a href="{{ url('user-profile', {'user': profile.user_id}) }}" class="input__button input__button--destroy profile__header__action">Discard</a>
|
||||
<a href="{{ url('settings-index') }}" class="input__button profile__header__action">Settings</a>
|
||||
{% elseif profile_can_edit %}
|
||||
<a href="{{ url('user-profile-edit', {'user': profile.user_id}) }}" class="input__button profile__header__action">Edit Profile</a>
|
||||
{% endif %}
|
||||
|
||||
{% if current_user is defined and current_user.user_id != profile.user_id and not profile_is_editing %}
|
||||
{% if profile_relation_info.user_relation == constant('MSZ_USER_RELATION_FOLLOW') %}
|
||||
<a href="{{ url('user-relation-none', {'user': profile.user_id}) }}" class="input__button input__button--destroy profile__header__action js-user-relation-action" data-relation-user="{{ profile.user_id }}" data-relation-type="{{ constant('MSZ_USER_RELATION_NONE') }}">Unfollow</a>
|
||||
{% else %}
|
||||
<a href="{{ url('user-relation-follow', {'user': profile.user_id}) }}" class="input__button profile__header__action js-user-relation-action" data-relation-user="{{ profile.user_id }}" data-relation-type="{{ constant('MSZ_USER_RELATION_FOLLOW') }}">Follow</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a href="{{ url('user-profile', {'user': profile.user_id}) }}" class="input__button profile__header__action">Return</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a href="{{ url('user-profile', {'user': profile.user_id}) }}" class="input__button profile__header__action">Return</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if stats is defined %}
|
||||
<div class="profile__header__stats">
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
{% from 'user/macros.twig' import user_profile_warning %}
|
||||
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text, input_checkbox, input_file, input_file_raw, input_select %}
|
||||
|
||||
{% set canonical_url = url('user-profile', {'user': profile.user_id}) %}
|
||||
{% set title = profile.username %}
|
||||
{% if profile is defined %}
|
||||
{% set canonical_url = url('user-profile', {'user': profile.user_id}) %}
|
||||
{% set title = profile.username %}
|
||||
{% else %}
|
||||
{% set title = 'User not found!' %}
|
||||
{% endif %}
|
||||
|
||||
{% block content %}
|
||||
{% if profile_is_editing %}
|
||||
|
@ -169,90 +173,92 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="profile__content__main">
|
||||
{% if (profile_is_editing and perms.edit_about) or profile.user_about_content|length > 0 %}
|
||||
<div class="container profile__container profile__about" id="about">
|
||||
{{ container_title('About ' ~ profile.username) }}
|
||||
{% if profile is defined %}
|
||||
<div class="profile__content__main">
|
||||
{% if (profile_is_editing and perms.edit_about) or profile.user_about_content|length > 0 %}
|
||||
<div class="container profile__container profile__about" id="about">
|
||||
{{ container_title('About ' ~ profile.username) }}
|
||||
|
||||
{% if profile_is_editing %}
|
||||
<div class="profile__signature__editor">
|
||||
{{ input_select('about[parser]', constant('MSZ_PARSERS_NAMES'), profile.user_about_parser, '', '', false, 'profile__about__select') }}
|
||||
<textarea name="about[text]" class="input__textarea profile__about__text" id="about-textarea">{{ profile.user_about_content|escape }}</textarea>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="profile__about__content{% if profile_is_editing %} profile__about__content--edit{% elseif profile.user_about_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
|
||||
{{ profile.user_about_content|escape|parse_text(profile.user_about_parser)|raw }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if (profile_is_editing and perms.edit_signature) or profile.user_signature_content|length > 0 %}
|
||||
<div class="container profile__container profile__signature" id="signature">
|
||||
{{ container_title('Signature') }}
|
||||
|
||||
{% if profile_is_editing %}
|
||||
<div class="profile__signature__editor">
|
||||
{{ input_select('signature[parser]', constant('MSZ_PARSERS_NAMES'), profile.user_signature_parser, '', '', false, 'profile__signature__select') }}
|
||||
<textarea name="signature[text]" class="input__textarea profile__signature__text" id="signature-textarea">{{ profile.user_signature_content|escape }}</textarea>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="profile__signature__content{% if profile_is_editing %} profile__signature__content--edit{% elseif profile.user_signature_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
|
||||
{{ profile.user_signature_content|escape|parse_text(profile.user_signature_parser)|raw }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if profile_warnings|length > 0 %}
|
||||
<div class="container profile__container profile__warning__container" id="account-standing">
|
||||
{{ container_title('Account Standing', false, profile_warnings_can_manage ? '/manage/users.php?v=warnings&u=' ~ profile.user_id : '') }}
|
||||
|
||||
<div class="profile__warning">
|
||||
<div class="profile__warning__background"></div>
|
||||
|
||||
{% if profile_warnings_can_manage %}
|
||||
<div class="profile__warning__tools">
|
||||
<div class="profile__warning__user">
|
||||
<div class="profile__warning__user__ip">
|
||||
User IP
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="profile__warning__user">
|
||||
<div class="profile__warning__user__username">
|
||||
Issuer
|
||||
</div>
|
||||
<div class="profile__warning__user__ip">
|
||||
Issuer IP
|
||||
</div>
|
||||
</div>
|
||||
{% if profile_is_editing %}
|
||||
<div class="profile__signature__editor">
|
||||
{{ input_select('about[parser]', constant('MSZ_PARSERS_NAMES'), profile.user_about_parser, '', '', false, 'profile__about__select') }}
|
||||
<textarea name="about[text]" class="input__textarea profile__about__text" id="about-textarea">{{ profile.user_about_content|escape }}</textarea>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="profile__about__content{% if profile_is_editing %} profile__about__content--edit{% elseif profile.user_about_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
|
||||
{{ profile.user_about_content|escape|parse_text(profile.user_about_parser)|raw }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="profile__warning__content">
|
||||
<div class="profile__warning__type">
|
||||
Type
|
||||
{% if (profile_is_editing and perms.edit_signature) or profile.user_signature_content|length > 0 %}
|
||||
<div class="container profile__container profile__signature" id="signature">
|
||||
{{ container_title('Signature') }}
|
||||
|
||||
{% if profile_is_editing %}
|
||||
<div class="profile__signature__editor">
|
||||
{{ input_select('signature[parser]', constant('MSZ_PARSERS_NAMES'), profile.user_signature_parser, '', '', false, 'profile__signature__select') }}
|
||||
<textarea name="signature[text]" class="input__textarea profile__signature__text" id="signature-textarea">{{ profile.user_signature_content|escape }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="profile__warning__created">
|
||||
Created
|
||||
{% else %}
|
||||
<div class="profile__signature__content{% if profile_is_editing %} profile__signature__content--edit{% elseif profile.user_signature_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
|
||||
{{ profile.user_signature_content|escape|parse_text(profile.user_signature_parser)|raw }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="profile__warning__duration">
|
||||
Expires
|
||||
</div>
|
||||
{% if profile_warnings|length > 0 %}
|
||||
<div class="container profile__container profile__warning__container" id="account-standing">
|
||||
{{ container_title('Account Standing', false, profile_warnings_can_manage ? '/manage/users.php?v=warnings&u=' ~ profile.user_id : '') }}
|
||||
|
||||
<div class="profile__warning__note">
|
||||
Note
|
||||
<div class="profile__warning">
|
||||
<div class="profile__warning__background"></div>
|
||||
|
||||
{% if profile_warnings_can_manage %}
|
||||
<div class="profile__warning__tools">
|
||||
<div class="profile__warning__user">
|
||||
<div class="profile__warning__user__ip">
|
||||
User IP
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="profile__warning__user">
|
||||
<div class="profile__warning__user__username">
|
||||
Issuer
|
||||
</div>
|
||||
<div class="profile__warning__user__ip">
|
||||
Issuer IP
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="profile__warning__content">
|
||||
<div class="profile__warning__type">
|
||||
Type
|
||||
</div>
|
||||
|
||||
<div class="profile__warning__created">
|
||||
Created
|
||||
</div>
|
||||
|
||||
<div class="profile__warning__duration">
|
||||
Expires
|
||||
</div>
|
||||
|
||||
<div class="profile__warning__note">
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% for warning in profile_warnings %}
|
||||
{{ user_profile_warning(warning, profile_warnings_view_private, profile_warnings_can_manage, profile_warnings_can_manage ? csrf_token('warning-delete[%d]'|format(warning.warning_id)) : '') }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% for warning in profile_warnings %}
|
||||
{{ user_profile_warning(warning, profile_warnings_view_private, profile_warnings_can_manage, profile_warnings_can_manage ? csrf_token('warning-delete[%d]'|format(warning.warning_id)) : '') }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,48 +1,55 @@
|
|||
{% extends 'master.twig' %}
|
||||
|
||||
{% set image = url('user-avatar', {'user': profile.user_id, 'res': 240}) %}
|
||||
{% set manage_link = '/manage/users.php?v=view&u=' ~ profile.user_id %}
|
||||
{% set stats = [
|
||||
{
|
||||
'title': 'Joined',
|
||||
'is_date': true,
|
||||
'value': profile.user_created,
|
||||
},
|
||||
{
|
||||
'title': 'Last seen',
|
||||
'is_date': true,
|
||||
'value': profile.user_active,
|
||||
},
|
||||
{
|
||||
'title': 'Following',
|
||||
'value': profile.following_count,
|
||||
'url': url('user-profile-following', {'user': profile.user_id}),
|
||||
'active': profile_mode == 'following',
|
||||
},
|
||||
{
|
||||
'title': 'Followers',
|
||||
'value': profile.followers_count,
|
||||
'url': url('user-profile-followers', {'user': profile.user_id}),
|
||||
'active': profile_mode == 'followers',
|
||||
},
|
||||
{
|
||||
'title': 'Topics',
|
||||
'value': profile.forum_topic_count,
|
||||
'url': url('user-profile-forum-topics', {'user': profile.user_id}),
|
||||
'active': profile_mode == 'forum-topics',
|
||||
},
|
||||
{
|
||||
'title': 'Posts',
|
||||
'value': profile.forum_post_count,
|
||||
'url': url('user-profile-forum-posts', {'user': profile.user_id}),
|
||||
'active': profile_mode == 'forum-posts',
|
||||
},
|
||||
{
|
||||
'title': 'Comments',
|
||||
'value': profile.comments_count,
|
||||
},
|
||||
{
|
||||
'title': 'Changes',
|
||||
'value': profile.changelog_count,
|
||||
},
|
||||
] %}
|
||||
{% if profile is defined %}
|
||||
{% set image = url('user-avatar', {'user': profile.user_id, 'res': 240}) %}
|
||||
{% set manage_link = '/manage/users.php?v=view&u=' ~ profile.user_id %}
|
||||
{% set stats = [
|
||||
{
|
||||
'title': 'Joined',
|
||||
'is_date': true,
|
||||
'value': profile.user_created,
|
||||
},
|
||||
{
|
||||
'title': 'Last seen',
|
||||
'is_date': true,
|
||||
'value': profile.user_active,
|
||||
},
|
||||
{
|
||||
'title': 'Following',
|
||||
'value': profile.following_count,
|
||||
'url': url('user-profile-following', {'user': profile.user_id}),
|
||||
'active': profile_mode == 'following',
|
||||
},
|
||||
{
|
||||
'title': 'Followers',
|
||||
'value': profile.followers_count,
|
||||
'url': url('user-profile-followers', {'user': profile.user_id}),
|
||||
'active': profile_mode == 'followers',
|
||||
},
|
||||
{
|
||||
'title': 'Topics',
|
||||
'value': profile.forum_topic_count,
|
||||
'url': url('user-profile-forum-topics', {'user': profile.user_id}),
|
||||
'active': profile_mode == 'forum-topics',
|
||||
},
|
||||
{
|
||||
'title': 'Posts',
|
||||
'value': profile.forum_post_count,
|
||||
'url': url('user-profile-forum-posts', {'user': profile.user_id}),
|
||||
'active': profile_mode == 'forum-posts',
|
||||
},
|
||||
{
|
||||
'title': 'Comments',
|
||||
'value': profile.comments_count,
|
||||
},
|
||||
{
|
||||
'title': 'Changes',
|
||||
'value': profile.changelog_count,
|
||||
},
|
||||
] %}
|
||||
{% else %}
|
||||
{% set image = url('user-avatar', {'user': 0, 'res': 240}) %}
|
||||
{% set manage_link = '/manage/users.php?v=listing' %}
|
||||
{% set profile_is_editing = false %}
|
||||
{% set profile_notices = [] %}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
{% extends 'user/master.twig' %}
|
||||
{% from 'macros.twig' import container_title %}
|
||||
|
||||
{% set title = 'User not found!' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
{{ container_title('User not found!') }}
|
||||
|
||||
<div class="container__content">
|
||||
<p>Check the url and try again.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Reference in a new issue