BuddyDev

Search

How to enable to upload MPP pics without entering text in BP Activity

  • Participant
    Level: Master
    Posts: 496
    Daniel on #35642

    Hi,

    I use MediaPress for uploading pics. When I want to upload a pic on BP Activity without writing a text, it says “please enter text” otherwise it doesn’t post the pic. Is there a way that the user can post pics on his BP actitvity without entering additional text?

    Thanks.

    Regards
    Daniel

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #35645

    Hello Daniel,

    Thank you for posing. Yes, It can be done easily for this you need to override ‘post_update’ ajax call by your own on lower priority before BuddyPress handle it. Following code is for Nouveau

    
    
    function buddydev_modify_post_update() {
    
    	if ( ! isset( $_POST['mpp-attached-media'] ) ) {
    		return;
    	}
    
         // Overidden code of 'bp_nouveau_ajax_post_update' function.
    
    }
    add_action( 'wp_ajax_post_update', 'buddydev_modify_post_update', 9 );
    
    

    Regards
    Ravi

    • This reply was modified 3 years, 3 months ago by Ravi.
  • Participant
    Level: Master
    Posts: 496
    Daniel on #35667
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 33
    Nestor Djintelbé on #35668

    Hello Ravi,

    Thank you for your reply to this Daniel’s post. I am interested in the question but I am using Legacy. How can I modify the code?

    Kind regards,

    Nestor

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #35669

    Hello Daniel, Nestor,

    Please try the following code. It will work for both nouveau and leagacy template.

    
    add_filter( 'bp_activity_type_requires_content', '__return_false' );
    
    

    Please let me know if it works or not.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 33
    Nestor Djintelbé on #35670

    Hello Ravi,

    Thank you very much. It works for me! Thank you for your help.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #35672

    Hello Nestor,

    Thank you for the acknowledgement.

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 496
    Daniel on #35673

    Hi Ravi,

    I use Nouveau template but the code doesn’t work. This means when I upload a photo on BP User activity, then only a message gets posted on activity saying, the user has posted a new photo, but the photo doesn’t show, it is empty, it only adds the photo to BP Wallphotos album but is invisible on user activity.

    Thanks for your time.

    Regards
    Daniel

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #35675

    Hello Daniel,

    Thank you for the acknowledgement. I have checked on your site and it is coming in hidden form following CSS rule hiding content. Please have look:

    
    
    .activity-list.bp-list li.mini .activity-inner {
        display: none;
    }
    
    

    in file “wp-content/themes/thrive-nouveau/css/buddypress.min.css”

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 496
    Daniel on #35679

    Hi Ravi,

    Awesome analytics!

    I have adapted the code.

    Thank you!

    Regards
    Daniel

You must be logged in to reply to this topic.

This topic is: not resolved