Admin edit on user avatar

Posted in: Newspaper
Post count: 388

I love the “edit” button on post thumbnails visible only to admins when they hover… it saves so much time. I was thinking recently of adapting that for user avatars as well. Where should I look for the relevant code that adds that? Do you think it would be an easy fix (changing URLs, css styles, etc.) or more complex?

Thanks!

Post count: 22421

Hello,
The code can be found here: http://screencast.com/t/3wTr4F1jyqc
The edit button works based on the user roles of wordpress: https://codex.wordpress.org/Roles_and_Capabilities#edit_posts
I cannot provide an easy solution for this as you will probably need a plugin that changes the user capabilities.
Thank you!

Post count: 388

Thanks! I’ve implemented it now. Actually, it turned out not to be too difficult 🙂

If anyone else wants this for future, all I had to do was add this modified version:

if (current_user_can('edit_users')) {
    $buffy .= '\<a target="_blank" href="' . get_edit_user_link($author_id) . '"\>edit\</a\>';
}

(Backslashes added for forum displaying…)

…right inside the <author_box_wrap> div, and add this CSS:

.author-box-wrap:hover .td-admin-edit {
  display: block;
  left: initial;
  top: initial;
}
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.