Hi,
I want to set cover photos based on roles. I use Publish Press Capabilities for role management.
I see your post here
https://buddydev.com/custom-default-buddypress-user-profile-cover-photo-based-wordpress-roles/
I can’t tell how old that post is.
Would it work with PP Capabilities? You mention capabilities but I don’t know if it’s Publish Press version.
Also, do you have a plugin to accomplish the same? That would be awsome 🙂
ThanksHello La,
Thank you for posting. In the backend Capabilities > Capabilities screen on checkbox hover you can see the capability name and Using these capabilities, you can try it.
Instead of this
bp_before_xprofile_cover_image_settings_parse_args
use this
bp_before_members_cover_image_settings_parse_args
If still facing issues you can share the capabilities with me and I will share the code. Please let me know
Regards
RaviHello La,
See if the following can help you.
/** * Set different default background images based on user roles * * @param array $settings * * @return array */ function buddydev_set_custom_default_profile_cover( $settings = array() ) { $displayed_user_id = bp_displayed_user_id(); if ( user_can( $displayed_user_id, 'list_users' ) ) { // Users with administrator role. $settings['default_cover'] = 'http://example.com/cover-admin.jpg'; } elseif ( user_can( $displayed_user_id, 'moderate_comments' ) ) { //editor // Users with editor role. $settings['default_cover'] = 'http://example.com/cover-editor.jpg'; } elseif ( user_can( $displayed_user_id, 'edit_published_posts' ) ) { //author // Users with author role. $settings['default_cover'] = 'http://example.com/cover-author.jpg'; } elseif ( user_can( $displayed_user_id, 'edit_posts' ) ) { // Users with contributor role. $settings['default_cover'] = 'http://example.com/cover-contributor.jpg'; } else { // Users with subscriber role. $settings['default_cover'] = 'http://example.com/cover.jpg'; } return $settings; } add_filter( 'bp_before_members_cover_image_settings_parse_args', 'buddydev_set_custom_default_profile_cover', 40 );
Regards
RaviThank you so much! I have since decided to give Youzify a try. After reading many posts about it in your forums, it looks like there are many compatibility issues. Not your fault, I know. Will the code you so generously provided here for default cover photos by role work in the context of Youzify do you think? I don’t believe they offer that capability.
Hi,
Thank you for the reply.
@ravisharma will be assisting you in the day.I don’t think the code will work and we do not use Youzify. We will not be able to assist if you use Youzify. We can definately assit if you use the default BuddyPress.
Regards
Brajesh
The topic ‘Default cover photo by role?’ is closed to new replies.