Hi Ryan,
Than you for posting.Are you looking it for shortcode or the directory page?
I just realized that my question my not be related to the original post. I am looking for a way to add the members name to the site wide photo gallery. It currently only shows the Album title.
Thank you Ryan.
Please let me check and I will post back.
Regards
BrajeshHi Ryan,
The following code will add the gallery creator’s name in the gallery title at all places/** * Injects gallery owner's name in the gallery title * * @param $title * @param $id * * @return string */ function mpp_custom_add_owner_name_gallery_title( $title, $id ) { $gallery = mpp_get_gallery( $id ); if ( ! $gallery ) { return $title ; } //do you want to only filter for certain component? uncomment the below lines /* if ( 'sitewide' !== $gallery->component ) { return $title; } */ return $title . '<span class="gallery-owner-user">' .sprintf( ' by: %s', bp_core_get_userlink( $gallery->user_id ) ) .'</span>'; } add_action( 'mpp_get_gallery_title', 'mpp_custom_add_owner_name_gallery_title', 10, 2 );
Hope that helps.
Regards
BrajeshYou can put it in your theme’s functions.php or in the bp-custom.php in the plugin’s directory
https://buddydev.com/docs/guides/guides/buddypress-guides/what-is-bp-custom-php/
Regards
Brajeshok, I added it to a bp-custom.php but did not work as intended. do you want me to create a separate thread for this ?
Nevermind, I didn’t have the bp-custom.php in the correct location. Eveything is working correctly now. Thank you !
Well I spoke to soon, look like when I user Is looking at there own gallery is messes up the html for upload , delete.
Wall photo Gallery by: Ryan Mckernan
view by: Ryan Mckernan”>upload by: Ryan Mckernan” class=”confirm mpp-confirm mpp-delete mpp-delete-gallery”>delete<div class=”mpp-item-actions mpp-gallery-actions”>
view by: Ryan Mckernan“>upload by: Ryan Mckernan” class=”confirm mpp-confirm mpp-delete mpp-delete-gallery”>delete </div>Well I spoke to soon, looks like when A user Is looking at there own gallery it messes up the html for upload , delete.
Wall photo Gallery by: Ryan Mckernan
view by: Ryan Mckernan”>upload by: Ryan Mckernan” class=”confirm mpp-confirm mpp-delete mpp-delete-gallery”>delete<div class=”mpp-item-actions mpp-gallery-actions”>
view by: Ryan Mckernan“>upload by: Ryan Mckernan” class=”confirm mpp-confirm mpp-delete mpp-delete-gallery”>delete </div>
The topic ‘Displaying title and user on shortcode pages’ is closed to new replies.