Thank you George.
I am looking forward to your feedback 🙂Thank you for the update.
You can do that by using the following code
$associated_gallery_id = get_post_meta( $post_id, '_mppc_associated_photo_gallery_id', true );
You should use the actual post id for fetching gallery id.
Yep that works great!
Now I have more to ask of you I’m afraid. I will need to set the privacy options from public to private after the post has been created, to you have a function for that?
I’m going to include a drop down in the post where the author can change the privacy of the gallery from public to private. I think I can handle most of the code for that, I just need to know te function to use for editing the gallery details.
Thanks
Thank you.
In order to update the gallery details, you can use the following function(s)
Updating gallery status(If you only need to update status)
mpp_update_gallery_status( $gallery, $status ); // $status can be any valid status e.g 'public', 'private' etc.
Or you can use
mpp_update_gallery( $args );
where $args can be
$args = array( 'id' => $gallery_id, // *Required 'title' => 'gallery title', // optional, if not given, keeps the current gallery title. 'description' => 'gallery description', //optional. 'slug' => 'gallery-unique-slug', 'creator_id' => $user_id,//who created this gallery. 'order' => 0, // menu order. 'component_id' => $user_id,//optional. will keep current component if not given. 'component' => 'sitewide', // optional 'status' => 'public', //new status 'type' => 'photo', //new type? );
Everything except the id is optional.
For example, Here is how we are updating the gallery description.
https://github.com/buddydev/mediapress/blob/master/core/ajax/mpp-ajax.php#L1049
Hope that helps.
Regards
Brajesh
The topic ‘ [Resolved] Adding a gallery automatically on post creation’ is closed to new replies.