BuddyDev

Search

Rename Wall Photo Gallery (2)

  • Participant
    Level: Initiated
    Posts: 9
    Francoise on #9871

    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

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #9883

    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.

  • Participant
    Level: Initiated
    Posts: 9
    Francoise on #9924

    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çoise

  • Participant
    Level: Initiated
    Posts: 9
    Francoise on #9943

    Hi, 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 lot

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #9944

    Hi 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
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #9961

    Hi,
    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
    Brajesh

  • Participant
    Level: Initiated
    Posts: 9
    Francoise on #9982

    Hi Brajesh,

    I have made the upgrade but if i put this code in the bp-custom.php i have a http error when i try to add something in the activity !

    Thanks if you can help me again !

    Regards
    Françoise

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #9985

    Hi 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.

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #9992

    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.

  • Participant
    Level: Enlightened
    Posts: 35
    Kir on #25019

    Hi I would really like to rename this file (wall photo gallery) on the members profile, how can I do this?

    To something like Profile Gallery
    Thank you

    Kind regards
    K

You must be logged in to reply to this topic.

This topic is: not resolved