Replies
Hi Brajesh
Thank you for your reply.
May I ask, what’s the difference between bblpro_post_submitted and bbl_pro_post_updated?
My biggest problem at this stage is that, as you may be aware, the Events Manager plugin stores some additional data in its own separate wp_em_events table. Everything seems to work fine (and an entry is automatically created in the wp_em_events) when a post is first submitted, and even when it’s approved but NOT when a post is updated (eg. if I change the dates with BBLPro, they don’t get changed in the wp_em_events table… and when I delete a post, it doesn’t get marked as deleted in the wp_em_events table either.
I do appreciate this is outside of the scope of your plugin, I’m just trying to capture the correct hooks so that I can (hopefully) update the wp_em_events table “manually” when necessary.
Regards
NikHi Brajesh
Thank you for getting back to me.
I wonder if it’s possible I may have used the wrong terminology ie. I’m using โbblpro_post_submission_prepared_dataโ to add (or update) some additional postmeta entries (based on a single entry in the BuddyBlog form), which are required by the Events Manager plugin eg. the plugin requires an entry for both ‘_event_start’ and ‘_event_start_local’.
This seems to work quite well but should I be using ‘bblpro_post_submitted’ instead?
The other issue I have is that when deleting a post with BuddyBlog Pro, it doesn’t automatically update the wp_em_events table which is why I was looking for an action related to this but hopefully one of those you’ve mentioned will do the trick.
Regards
NikHi Brajesh
Thank you so much. I’m pleased to report that both of the options you’ve suggested seem to work perfectly.
In waiting for your reply, I’d also put together my own custom query for the Elementor posts widget along very similar lines and which I thought I would post here for reference and/or just in case it’s of interest to anyone else…
add_action( 'elementor/query/my_custom', function( $query ) { // Get current meta Query $meta_query = $query->get( 'meta_query' ); // If there is no meta query when this filter runs, it should be initialized as an empty array. if ( ! $meta_query ) { $meta_query = []; } // Append our meta query $meta_query[] = [ 'key' => '_bblgroups_group_id', 'compare' => 'NOT EXISTS', ]; $query->set( 'meta_query', $meta_query ); } );
Note: I did wonder if I’d need to do the same for “Related Posts” widgets but so far I can’t find any evidence of group posts appearing as related to personal posts. Not sure if this is by luck or design(!) but I’ll monitor just in case.
As always, many thanks for your assistance.
Regards
NikHi Brajesh
Thank you for getting back to me. Yes I’m using the core WordPress recent posts widget on some of the pages so if you can let me know the code for that, it would be very helpful. (I’m also using Elementor but that allows you to use a custom query so if you can possibly give me the example for the core widget, I can probably figure this part out myself.)
With many thanks in advance.
NikHi Brajesh
Thank you for your thoughts and I will give them some consideration.
Both BuddyBlog and Events Manager do what they’re designed to do really well, and my challenge all along has been to combine the best elements of both whilst presenting them in a coherent, user-friendly way (ideally with a single tab in the personal and group profiles).
I think I’m still going to struggle to list entries which are, let’s say, “pending”, according to BuddyBlog using an EM shortcode but will definitely explore that option a bit more.
I really am very grateful for all your support which I do appreciate is rather beyond the scope of your plugins themselves ๐
Regards
NikOh dear… I spoke to soon.
I edited query_posts as shown below (for the Events posts.php template) but it’s not sorting nor excluding older dates. The format of the post meta field _event_start_date is ‘2022-11-23’.
query_posts( bblgroups_get_posts_query_args( array( 'post_type' => bblpro_get_current_post_type(), 'order' => 'DESC', 'orderby' => 'meta_value', 'meta_key' => '_event_start_date', 'meta_query' => array( array( 'key' => '_event_start_date', 'value' => date('Ymd'), 'compare' => '>=' ) ) ) ) );
Any suggestions would be much appreciated.
Regards
Nik