BuddyDev

Search

Activity Form doesn't attach MediaPress media

  • Participant
    Level: Enlightened
    Posts: 21
    Abe on #4763

    – When you “Add Media” from a Gallery Page it **DOES** create an activity item, but there’s no description.
    – When you upload an image from the “Activity Form” it does add it to the gallery, but it **DOES NOT** create a new activity item.
    – Pressing “Post Update” only uploads the words inside the textarea as an activity item, **skipping** attaching the currently uploaded image to the activity status.

    **_GAMEPLAN:_**
    You can add shortcode support for activity statuses

    function oi_add_shortcodes_to_activity_stream() {
    		add_filter( 'bp_get_activity_content_body', 'do_shortcode', 1 );
    }
    add_action('bp_init', 'oi_add_shortcodes_to_activity_stream');

    Going to code a way to automatically add
    [mpp-media id=XXX] or
    [mpp-list-media id=XXX]

    into the current activity item so that when you DO press ‘Post Update’ it also includes a shortcode to the just uploaded media.

    Also it might be possible to implement a repost / reblog feature using this method? The same way Default Buddypress allows to @ people by clicking on a button on their profile page.

    Is this a good way to approach it?

  • Keymaster
    (BuddyDev Team)
    Posts: 21517
    Brajesh Singh on #4764

    Hi Abe,
    Thank you for posting here.

    1. Which theme are you using? Is it possible to provide me a tem,prary normal user account to test it. Are you usign any plugin like wall or wire/activity privacy?

    About reblog, I suggest checking the BuddyPress Rechare plugin by imath
    https://github.com/imath/bp-reshare

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 21
    Abe on #4765

    Ok I have another site for testing
    https://626life.com

  • Participant
    Level: Enlightened
    Posts: 21
    Abe on #4766
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 21
    Abe on #4767

    Thank you for the quick reply, I see your posts on 626life.com.

    This is with default buddypress and no buddypress theme templates on the wp theme.

  • Keymaster
    (BuddyDev Team)
    Posts: 21517
    Brajesh Singh on #4768

    Thank you.
    I tested it and I am not sure why but it seems this code in mpp.js is not triggering on your site when we post update

    
       //filter ajax request but only if the activity post form is present
    	if( jq( '#whats-new-form' ).get(0) ) {
    		
    		
    		jQuery( document ).ajaxSend(function( event, jqxhr, settings ) {
    			
    			if( is_post_update( settings.data ) ) {
    				var attached_media = mpp_get_attached_media();
    				
    				if( attached_media ) {
    					settings.data = settings.data+ '&mpp-attached-media='+attached_media;
    					mpp_reset_attached_media();
    				}
    			}
    		});
    		
    		
    
    

    The above code includes uploaded media ids in the post. I checked using mpp_get_attached_media() helper function in console and uploaded media ids are attached but the above code is not triggering and that is causing the problem.

    Can you think of something on the site that might be causing it?

  • Participant
    Level: Enlightened
    Posts: 21
    Abe on #4769

    Not sure either. I added this to the end of the if statement to catch and I don’t get any response

    else {
    		console.log('#whats-new-form is not available');
    	}
    
  • Participant
    Level: Enlightened
    Posts: 21
    Abe on #4770

    One thing I did notice that usually when I use Sublime Text Editor

    and I put the | cursor near a {

    it usually adds an underline to the { and the ending }

    but in this case

    the { on Line 1 doesn’t show an underline.

    possibly because it isn’t there or because another function isn’t closed properly.

    going to keep looking

  • Participant
    Level: Enlightened
    Posts: 21
    Abe on #4771

    I also found that the very last function mpp_mejs_activate closes with the very last line }

    is this intended or did you mean to close the Line 1 { with the very last }

  • Participant
    Level: Enlightened
    Posts: 21
    Abe on #4772

    Tested by putting this code

        if( jq( '#whats-new-form' ).get(0) ) {
            console.log('#whats-new-form is available');
        } else {
            console.log('#whats-new-form is unavailable');
        }

    right after the
    var jq = jQuery;

    and im getting a response, going to keep moving this down the line until i find where it breaks

    • This reply was modified 6 years ago by Abe.

You must be logged in to reply to this topic.

This topic is: not resolved