[wp-trac] [WordPress Trac] #41544: $id_or_email parameter in get_avatar filter needs to be more concrete
WordPress Trac
noreply at wordpress.org
Fri Oct 13 12:32:15 UTC 2017
#41544: $id_or_email parameter in get_avatar filter needs to be more concrete
----------------------------+------------------------------
Reporter: dikiy_forester | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version:
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses:
----------------------------+------------------------------
Changes (by birgire):
* keywords: => dev-feedback
Comment:
I support this. I remember stumbling up on this problem here
https://wordpress.stackexchange.com/questions/228870/custom-user-avatar-
in-the-wordpress-users-listing/228913#228913
with similar thoughts for an attribute or a function.
I'm planning to look into this.
Here's a suggestion:
Take the similar approach as with the processed {{{found_avatar}}}
argument and introduce {{{found_user_id}}}.
When user is found then {{{found_user_is}}} is the user id, else it's
{{{0}}}.
We note that {{{found_avatar}}} and {{{found_user_id}}} are not available
in the {{{pre_get_avatar}}} arguments.
We could additionally add a new function {{{wp_parse_id_or_email(
$id_or_email )}}} that would return an array like:
{{{
Array(
[user_id] => 1
[email] => user at example.org
[email_hash] => 572c3489ea700045927076136a969e27
[context] => numeric
)
Array
(
[user_id] => 0
[email] => user at example.org
[email_hash] => 572c3489ea700045927076136a969e27
[context] => email-address
)
Array
(
[user_id] => 0
[email] =>
[email_hash] => 572c3489ea700045927076136a969e27
[context] => md5-hash
)
Array
(
[user_id] => 1
[email] => user at example.org
[email_hash] => 572c3489ea700045927076136a969e27
[context] => post
)
Array
(
[user_id] => 1
[email] => user at example.org
[email_hash] => c52e94b32934ec08c573b1c850a7a8a3
[context] => allowed-comment-type
)
Array
(
[user_id] => 0
[email] =>
[email_hash] =>
[context] => disallowed-comment-type
)
}}}
where the possible input context values would be
{{{
'numeric', 'md5-hash', 'email-address', 'user', 'post', 'allowed-comment-
type', 'disallowed-comment-type'
}}}
The {{{context}}} could also be added as a processed argument aka
{{{found_avatar}}}.
What do you think of this plan?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41544#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list