BuddyDev

Search

[Resolved] Adding a gallery automatically on post creation

  • Participant
    Level: Master
    Posts: 413
    Venutius on #12736

    Well that took me longer than expected, but that works – thanks!

    Next I want to wrap the code in a check to see if MediaPress is active to prevent errors, what would you suggest as a check?

  • Participant
    Level: Master
    Posts: 413
    Venutius on #12737

    Hi Brajesh, I’m going to be using Global Shared Gallery with this plugin. Would you have a code I could add to set each gallery created as shared?

    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12742

    Hi George,

    you can use

    
    if( function_exists('mediapress') ) {
    // 
    }
    
    

    to check if MediaPress is active.

    To mark a gallery as global shared, you can do the follwoing

    
    mpp_update_gallery_meta( $gallery_id, '_mpp_is_all_upload_allowed', 1);
    
    

    Hope that helps.

  • Participant
    Level: Master
    Posts: 413
    Venutius on #12764

    Thanks Brajesh, I’ve been a bit busy today so I’ll test it tomorrow.

    How difficult would it be to enhance Global Shared Gallery so that it supported “friends only” as an option?

  • Participant
    Level: Master
    Posts: 413
    Venutius on #12766

    Hi Brajesh,

    Could you confirm the code I need to use to set it back to private uploads?

    I thought the following would work, but it does not:

    mpp_update_gallery_meta( $gallery_id, '_mpp_is_all_upload_allowed', 0);

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12769

    Hi George,
    If you are using the global shared gallery, the code

    
    mpp_update_gallery_meta( $gallery_id, '_mpp_is_all_upload_allowed', 0)
    

    Marks a gallery as shared and anyone can upload to it.

    To undo that, you should delete the meta.

    The above code does not change the status of the gallery. For changing status/privacy, please see my post about mpp_update_gallery.

    Regards
    Brajesh

    PS:- We will release Shared Gallery anytime soon where a user can give fine grained control like ‘view’, ‘edit’, ‘upload’, ‘delete’ to other specific members.

  • Participant
    Level: Master
    Posts: 413
    Venutius on #12771

    Ah, I see thanks Brajesh! I’ll look at that tonight.

    I’ve got another request – How do I delete a gallery? I’d also like to automatically delete the gallery once the user deletes the page.

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12772

    Thank you George.

    To delete a gallery, you can use the following

    
    mpp_delete_gallery( $gallery_id, true );
    

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 413
    Venutius on #12773

    That’s great, nice and simple.

    Now there is something that’s come up. As you recall I’ve created a custom post-type with custom fields. The strange thing is that the galleries seem to have adopted some of my custom fields – so when I go to edit a gallery direct, five of my custom fields show up in the custom fields section, two of them ppulated with data from the post. I can’t think why that would happen as the gallery has a different post_id to the custom post. I’ve got some ideas as to why that may be (probably coding errors) but off-hand I can’t see how it’s happening.

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12786

    Hi George,
    That is very strange.

    Can you please post the code somewhere and link me?

    Thank you
    Brajesh

The topic ‘ [Resolved] Adding a gallery automatically on post creation’ is closed to new replies.

This topic is: resolved