-
Improvement
-
Resolution: Fixed
-
Minor
-
3.3.20-RC1
-
None
TYPE
====
PHP event + template event
LOCATION (PHP)
==============
includes/mcp/mcp_notes.php, function mcp_notes_user_view(), immediately
before the final $template->assign_vars() call (after $rank_data and
$avatar_img are computed):
$rank_data = phpbb_get_user_rank($userrow, $userrow['user_posts']);
$avatar_img = phpbb_get_user_avatar($userrow);
/**
* Modify user data before it is assigned to the template on the MCP user-notes page
*
* @event core.mcp_notes_user_modify_template_vars
* @var array userrow The entire user row
* @var array rank_data Array with rank title/img for this user
* @var string avatar_img Rendered avatar HTML for this user
* @since to be filled in by the phpBB dev team at merge time
*/
$vars = array('userrow', 'rank_data', 'avatar_img');
extract($phpbb_dispatcher->trigger_event('core.mcp_notes_user_modify_template_vars', compact($vars)));
$template->assign_vars(array(
'U_POST_ACTION' => $this->u_action,
...
LOCATION (template)
====================
styles/prosilver/template/mcp_notes_user.html, immediately after the
RANK_IMG line, inside the same details list as JOINED/POSTS/WARNINGS:
<dl class="details">
<!-- IF RANK_TITLE --><dt>{L_RANK}
<!-- IF RANK_IMG -
<!-- ENDIF -></dt><dd>{RANK_IMG}</dd><!- ENDIF -->
{% EVENT mcp_notes_user_rank_after %}
<dt>{L_JOINED}
</dt><dd>{JOINED}</dd>
PURPOSE
=======
mcp_notes.php has zero trigger_event() calls anywhere in the file, and
mcp_notes_user.html has no event tag anywhere either - there is no way
to add anything to this page, PHP-side or template-side, without
overriding the whole template.
USE CASE
========
phpbbmodders/displaygroupsrank (shows extra rank images for every group
a user belongs to, alongside their normal rank) covers the profile
page, topic posts, PM view, the member list, and the team page through
existing events, but cannot cover this page at all without a new one.
Same gap as core.mcp_warn_user_modify_template_vars and
core.mcp_warn_post_modify_template_vars (see those RFCs) - all three
MCP user-detail pages share the identical details-block markup for
rank/joined/posts/warnings, and all three lack any hook near it.
VARIABLES
=========
- userrow (array, read-only) - the entire user row
- rank_data (array, read-only) - rank title/img for this user
- avatar_img (string, read-only) - ren

