Using header cover
Search the documentation for info relating to cover images. this page talks about the function that calls the cover image:
Also check out the overload files, I believe buddypress/members/single/cover-image-header.php is the page that fires to create the cover image, so you could use that as a basis for some custom code I reckon.
Can you point me to a guide for noobs?
I dont know much of buddypress and its structure.
BUt would like it get to know.
This page explains about template overloads, but really you are not looking to do that, just view the contents of wp-content/buddypress/bp-templates/bp-legacy/buddypress/members/single/coer-image-header.
You are looking to display the cover based header info and this is the page that does that in BP. However one thing to note is that these functions will only work in a BP profile page since they are using displayed username to identify the cover info to publish. So I guess this depends on what page you are looking to publish this info on?
An alternative I looked at is to use the BuddyPress Profile Shortcodes plugin, but unfortunately this does not include a shortcode for the cover image, most of the other information you re after though, they can get.
VapVarun has suggested some code that would return the url for the members cover image, you could use this as a basis for developing some code?
$args = array( 'object_dir' => 'members', 'item_id' => $user_id = bp_get_member_user_id(), 'type' => 'cover-image', ); $cover_img_url = bp_attachments_get_attachment( 'url', $args ); <img src="' . $cover_img_url . '" />
If you want to get to know the structure of the BP overload files, could I suggest you try installing https://wordpress.org/plugins/bp-template-overloader/ this maps out all of the overload files, it’s pretty daunting the sheer number of files you can modify, but if you look for that one file you can view it’s contents.
Also the link I mentioned but forgot to include about overloading BP is here. https://codex.buddypress.org/themes/theme-compatibility-1-7/a-quick-look-at-1-7-theme-compatibility/
I think what you are looking for is the ability to place a shortcode on a page, that displays the members header on a page of your choice for any given member id.
There isn’t such a thing, however https://wordpress.org/plugins/buddypress-profile-shortcodes/ comes close in that it allows you to display most of the components of the members header on a page.
BuddyPress Profile shortcodes is a pretty simple plugin, I think it should be possible to combine VapVarun’s contributed code with BP Profile Shortcodes in order to create a shortcode that does something similar to what you are looking for.
OK I’ve added the ability to display cover images to the shortcode. I’ve emailed the plugin author to see if they will accept my contribution.
However, that does not give you exactly what you need: A fully formatted copy of that individuals profile header – integrating user name, cover image, avatar etc.
For that I think a much bigger fork in the plugin would be required. However this gives you the components, you could create the layout that you need using css I reckon.
- You must be logged in to reply to this topic.