BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25057
    Brajesh Singh on in reply to: Localization of site wide activity plugin? #1103

    That’s good to know 🙂

    I will still update it to make sure it is completely translatable.

  • Keymaster
    (BuddyDev Team)
    Posts: 25057
    Brajesh Singh on in reply to: [Resolved] Language files not "taking" #1102

    Yes, you are right. If you have poedit, you can do it yourself by simply updating path in settings and updating the catalog.
    I am holding the update to provide fix for one more issue I have noticed.

  • Keymaster
    (BuddyDev Team)
    Posts: 25057
    Brajesh Singh on in reply to: Simple Front End Post plugin show "Add Media" button #1101

    Hi James,
    Welcome to BuddyDev forums.
    It is doable, the concern is media management. How do we allow users to manage their media after upload. I am not sure about the UI.

    Do you have suggestions about that?

  • Keymaster
    (BuddyDev Team)
    Posts: 25057

    Marking resolved as per emails.

  • Keymaster
    (BuddyDev Team)
    Posts: 25057

    Mailed you. please check.

  • Keymaster
    (BuddyDev Team)
    Posts: 25057

    Hi Hans,
    Thanks for opening the topic. And yes, you read that right, It will be easy to make it work with any plugin. I was planning to show some examples for woocommerce/easy digital download but then stopped.

    Please send me the details and I will post code 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 25057

    Btw, For shortcodes, the equivalent hook is

    
    
    mpp_before_media_shortcode_item
    mpp_after_media_shortcode_item
    

    instead of

    
    mpp_before_media_item
    mpp_after_media_item
    

    The ‘mpp_before_media_item’ is used on single gallery loop. For widgets, in the same way the hooks are

    
    
    mpp_before_media_widget_item
    mpp_after_media_widget_item
    
    

    Hope that helps.

  • Keymaster
    (BuddyDev Team)
    Posts: 25057

    Hi Johan,
    Thank you.

    I will post the code with explanations then. Also, if you need any help doing a custom Media Query, please do let me know. It is very simple(just like WP_Query)

    1. To get the uploader user id inside the loop, we can use the following function

    
    $user_id = mpp_get_media_creator_id();//get the id of user who uploaded this media
    
    

    If you are not inside the loop, you can pass media id or object to that function like

    
    $media_id = 32;
    
    $user_id = mpp_get_media_creator_id( $media_id );//accepts id or MPP_Media object or attachment post object 
    
    

    So, we are done with the user id part.

    2. In BuddyPress, there are multiple ways to link to user.

    Easiest way is to use

    
    bp_core_get_userlink( $user_id )
    
    

    That gives a link to the user profile with his/her Name linked

    so, we can use it like this

    
    echo bp_core_get_userlink( mpp_get_media_creator_id() );
    
    

    If you are interested in linking to the username instead( Using username as the link label instead of the full name), we will need 2 functions, one for getting url of the user and another to get the username. Those are easy and there are again multiple way

    
    
    $url = bp_core_get_user_domain( $user_id );//will return a ulr like http://site.com/members/xyz/
    
    $username = bp_core_get_username( $user_id );// returns username e.g 'admin', 'sbrajesh' etc
    
    

    So, we can build a link with them like this

    
    
    <a href="<?php echo bp_core_get_user_domain( $user_id );?>"><?php echo bp_core_get_username( $user_id );?></a>
    
    

    That will give us a link to the username if we decide to choose this method. we can write it inside a function and pass the user id to get the link

    Now, the last part is to display the link in the media loop

    Here, you will need to decide whether you are going to use the shortcode or creating a custom loop yourself.

    If you are using a shortcode, we can hook to action ‘mpp_after_media_item’ and echo the user link. If you are using the custom query, you can list the username where you want.

    Here is an example using the hook

    
    add_action( 'mpp_after_media_item', 'mpp_custom_add_user_link' );
    function mpp_custom_add_user_link() {
    	//you may put some conditions here like
    
           //mpp_is_single_gallery();
            //mpp_is_single_media();
           //to avoid showing it on single gallery/media pages
    
    	$user_link = bp_core_get_userlink( mpp_get_media_creator_id() );
    	echo $user_link;
    }
    
    

    Though it is possible to filter title of media using the hook ‘mpp_get_media_title’, title is not always displayed( you might have already noticed it for photos, also, titles are linked and putting a link inside link will generate invalid html ). You can put some text though.

    Another action that might interest you is ‘mpp_before_media_item’, it is same as ‘mpp_after_media_item’ except that it is called before showing the media content.

    Hope that helps.

  • Keymaster
    (BuddyDev Team)
    Posts: 25057
    Brajesh Singh on in reply to: Localization of site wide activity plugin? #1087

    That will be my mistake. I missed updating the widget UI while concentrating on the list display.

    Thank you for letting me know, will need to update it again today.

  • Keymaster
    (BuddyDev Team)
    Posts: 25057
    Brajesh Singh on in reply to: [Resolved] Language files not "taking" #1086

    Hi Jan,
    Thank you for updating. You are right the old po file was not updated. Will do an update and push today.

    Thank you
    Brajesh