Tagged: mediapress, rename, wall-photo-gallery
Hello
Sorry i create a new topic it is the same topic as this one :
https://buddydev.com/support/forums/topic/rename-wall-photo/But i don’t undrstand how to use your answer of this question !
The code :
mpp_get_activity_wall_gallery()
I don’t see it in the documentation and i don’t know where to put the remove filter ???So thanks again a lot for your help.
Françoise
Hi Francoise,
Thank you for asking.Do you want to rename for groups only or for all user/groups wall gallery.
If you want to change it for all user/groups gallery, you can simply put a translation for “Wall %s Gallery”
If that is not the case, Please do let me know.
Hi Brajesh,
I would like to rename by the name of the group.I’m using this shortcode : mpp-list-gallery
The name is always : Wall photo galerie
I would like to have the name of the group exemple : for the group “Repair café” to have “Repair café Photo” or for the group “Permaculture” to have “Permaculture Photo”.
Is it possible ?
Thanks for your answer
FrançoiseHi, So to explain what i want it’s to understand how to do with this answer you give to nick in that post : https://buddydev.com/support/forums/topic/rename-wall-photo/
———-
Step 1: Force MediaPress to avoid creating the context gallery on demand:-remove_filter( ‘mpp_get_context_gallery’, ‘mpp_get_activity_wall_gallery’, 10, 2 );
Now, Provide your own context gallery helper by adding to the filter ‘mpp_get_context_gallery’ Please see how we do it in
mpp_get_activity_wall_gallery()
You can check the $args’component’] ==’groups’ to check it it is for groups wall gallery. Hope that helps.
——-Can you tell me where to put the remove_filter and how to use the mpp_get_context_gallery.
Thanks a lotHi Francois,
I am working on having a better way to do it. That’s why I did not release MediaPress yesterday. I am aiming to have a better option for this today and then release.Thank you
BrajeshHi,
Please upgrade to 1.1.6 and then you can put the following code in your bp-custom.php/** * Filter wall gallery title * * @param string $title name of the wall gallery. * @param array $args { * Context details. * @type string $component component name(e.g groups|members|sitewide) * @type int $component_id numeric component id( e.g group id or user id based on the component) * @type string $type media type(e.g photo, video,audio, doc etc) * * } * * @return string new title */ function mpp_custom_wall_gallery_name( $title, $args ) { // in this example, we are going to change the title for the groups wall gallery like this // <group name> wall gallery. if ( 'groups' === $args['component'] ) { $title = sprintf( '%s wall %s gallery', groups_get_group( $args['component_id']->name ), mpp_get_type_singular_name( $args['type'] ) ); } return $title; } add_filter( 'mpp_wall_gallery_title', 'mpp_custom_wall_gallery_name', 10, 2 );
That will do it.
Regards
BrajeshHi Francoise,
I will test and report back. I see there is a typo in my above code$title = sprintf( '%s wall %s gallery', groups_get_group( $args['component_id']->name ), mpp_get_type_singular_name( $args['type'] ) );
It should be
$title = sprintf( '%s wall %s gallery', groups_get_group( $args['component_id'])->name , mpp_get_type_singular_name( $args['type'] ) );
Most probably taht is causing the issue. I will still test and report back.
Hi,
That last modification makes it work.Here is a better version though
/** * Filter wall gallery title * * @param string $title name of the wall gallery. * @param array $args { * Context details. * @type string $component component name(e.g groups|members|sitewide) * @type int $component_id numeric component id( e.g group id or user id based on the component) * @type string $type media type(e.g photo, video,audio, doc etc) * * } * * @return string new title */ function mpp_custom_wall_gallery_name( $title, $args ) { // in this example, we are going to change the title for the groups wall gallery like this // <group name> wall gallery. if ( 'groups' === $args['component'] ) { $title = sprintf( '%s wall %s gallery', groups_get_group( $args['component_id'] )->name, strtolower( mpp_get_type_singular_name( $args['type'] ) ) ); } return $title; } add_filter( 'mpp_wall_gallery_title', 'mpp_custom_wall_gallery_name', 10, 2 );
I have tested it and it works fine.
Hope that helps.
You must be logged in to reply to this topic.