BuddyDev

Search

[Resolved] Mediapress Bulk Uploads again…

  • Participant
    Level: Master
    Posts: 279
    NikB on #32931

    Wow… that works! Thank you so much Ravi.

    Not quite sure where I came up with ‘mpp_media_publish’ as an activity type, but I think I must have misunderstood as I now see that’s used as an activity meta entry for _mpp_activity_type. (The confusing thing was that changing the activity type as I described, DID actually seem to work but I’m not going to lose any sleep over figuring that one out, since your way is obviously the oorrect way and saves having to fiddle with the code any further)!

    Now… if I can just find a way of keeping the user on the same (upload) page when they click “Publish” (as described in my point 1 above), things would be just perfect but I’m rather guessing the fact that they get sent to the “Edit Gallery” page is down to the js and therefore may be trickier to amend?

    Thank you again and regards
    Nik

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

    Hello Nik

    Try the following code. It will publish media using ajax and show feedback message.

    
    add_action( 'mpp_enqueue_scripts', function () {
    	// If we are not single gallery add media screen return.
    	if ( ! mpp_is_gallery_add_media() ) {
    		return;
    	}
    
    	$gallery_id = mpp_get_current_gallery_id();
    	$link       = mpp_gallery_get_publish_activity_url( $gallery_id );
    
    	$publish_link = sprintf( 'Click <a class="mpp-publish-to-activity-button" href="%s" rel="noopener">%s</a> HERE.', $link, __( 'Publish' ) );
    
    	wp_add_inline_script(
    		'mpp_uploader',
    		"jQuery(document).on( 'mpp:uploader:upload:complete', function( self, up, files ) {
    			jQuery('div#mpp-uploaded-media-list-gallery').append('" . $publish_link . "');
    			} );"
    	);
    }, 11 );
    
    

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 279
    NikB on #32937

    Hi Ravi

    I am in your debt once again! That seems to work very well except… for some reason I’m not getting the feedback message…

    I hardly dare ask but any suggestions as to why that might be? (I tried changing to Twenty Twenty theme and have the same issue so it’s not the theme.)

    Regards
    Nik

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

    Hello NikB,

    Are you able to get other notices as it is working for me?. check the following URL:

    https://ibb.co/3N4NwBJ

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 279
    NikB on #32941

    Hmm… that’s really odd. I DO get notices on the Edit Gallery page, but not on the Upload page.

    So far I’ve tried… switching to Twenty Twenty theme, switching from Firefox to Chrome, and also removing ALL code from my bp-custom.php file (except that required to generate the Publish link) in order to exclude any other customisations I might have made.

    It seems unlikely that it could be a plug-in conflict since the notices work fine on the Edit Gallery page so I can’t think why another plug-in would be affecting just the one page but since from your screenshot, the issue clearly seems to be on my side of things, I’ll see what else I can think of!

    Thank you again for your help… I can see that everything you’ve suggested *should* be working. Now I juat have to figure out why it’s not for me 😉

    Regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on #32949

    Hey Ravi

    Just to follow up on this… I re-installed a fresh copy of Mediapress and it now works like a dream! (I can only assume I may have accidentally edited one of the core files when trying to get this to work – yes I know that’s a big “no no” and will teach me to be more careful in future 😉 )

    Thank you again for working with me on this. The site has been running for over a year now and the users have been nagging for this feature but initially I just couldn’t see how it could be achieved.

    I do have to say, I personally feel this should be the default behaviour (ie. bulk uploads get posted as a single activity, as would happen with Facebook etc.) but I can only assume there are good reasons why Mediapress doesn’t work this way, and I think together we’ve at least found a perfectly acceptable work-around.

    Warm regards
    Nik

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

    Hello NikB,

    Thank you for the acknowledgement. I am glad that you have resolved it by own and Thank you for your suggestion we will thing of it in future MediaPress releases.

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: resolved