Inside wp-user-avatar/includes/class-wp-user-avatar-shortcode.php
, inside public function wpua_edit_shortcode
replace this
$valid_user = current_user_can('edit_user', $get_user) ? $get_user : null;
to this
$valid_user = current_user_can('edit_user', $get_user->ID) ? $get_user : null;
Also, capability edit_user
need to be edit_users
or include both of them.
Have a nice work and we waiting new update!
Thanks!
]]>I see someone else reported a similar issue (forum post now closed) here:
https://www.ads-software.com/support/topic/custom-user-role-doesnt-appear-in-dropdown-list-of-author/
The solution suggested in the last post of that thread didn’t work for me. I came up with my own workaround (assigning editor as a second role for each of these users), but I remain puzzled about why this bug occurred in the first place. Shouldn’t the determination of which users are included in the dropdown be based on capabilities, not role names? I even see a reference to the long since deprecated role levels in the source code.
custom role setup:
function add_awesome_roles() {
$manager = get_role('manager');
if(!$manager)
add_role( 'manager', 'Manager', array( 'delete_others_pages' => true,
'read' => true,
'upload_files' => true,
'delete_others_posts' => true,
'delete_pages' => true,
'delete_posts' => true,
'delete_private_pages' => true,
'delete_private_posts' => true,
'delete_published_pages' => true,
'delete_published_posts' => true,
'edit_others_pages' => true,
'edit_others_posts' => true,
'edit_pages' => true,
'edit_posts' => true,
'edit_private_pages' => true,
'edit_private_posts' => true,
'edit_published_pages' => true,
'edit_published_posts' => true,
'manage_categories' => true,
'manage_links' => true,
'moderate_comments' => true,
'publish_pages' => true,
'publish_posts' => true,
'read_private_pages' => true,
'read_private_posts' => true,
'delete_others_rsvpmakers' => true,
'delete_rsvpmakers' => true,
'delete_others_pages' => true,
'edit_published_rsvpmakers' => true,
'publish_rsvpmakers' => true,
'read_private_rsvpmakers' => true,
'promote_users' => true,
'remove_users' => true,
'delete_users' => true,
'list_users' => true,
'edit_users' => true,
"view_reports" => true,
"view_contact_info" => true,
"edit_signups" => true,
"edit_member_stats" => true,
"edit_own_stats" => true,
"agenda_setup" => true,
"email_list" => true,
"add_member" => true,
"edit_members" => true
) );
}
My workaround is to add a second role, editor, to every manager.
function manager_author_editor () {
$users = get_users([ 'role__in' => [ 'manager' ], 'role__not_in' => [ 'editor' ], 'blog_id' => get_current_blog_id() ]);
foreach ($users as $user) {
$user->add_role('editor');
}
}
add_action('admin_init','manager_author_editor');
Since the plugin code has been shipping for some time, this is the best solution I’ve been able to come up with to make sure users previously assigned the manager role will be included in the Authors dropdown.
]]>Replace the fixed value : Mail Administrator
by : Email Seller
Capturing the mail, user “seller” who posted the article.
Eg, there are 3 users vendors.
Seller 1 = [email protected]
Seller 2 = [email protected]
Seller 3 = [email protected]
A visitor, view product seller 3
Want to send message, and use the form
The form captures the recipient field of the emal seller 3
You could use the function get_user_by or similar ?
https://www.ads-software.com/plugins/product-enquiry-for-woocommerce/
]]>But i want to show five random authors in a page. Is their any way i can do it with those functions or i have to use general sql query?
]]>