Replies
- NikB on December 10, 2022 at 7:40 am in reply to: [Resolved] BuddyBlog delete action hook/filter #47571
Hi 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
Nik Hi Brajesh
Oh that would be great thank you!
My client will be happy with this one as they were finding it a bit confusing ๐
I’ll look out for the addition in due course.
Regards
Nik- NikB on November 29, 2022 at 10:49 am in reply to: [Resolved] BuddyBlog Pro – exclude from recent posts #47490
Hi Brajesh
I think/hope it should work anywhere that Elementor Pro allows you to use a custom query, but I’ll get back to you if I come across anywhere that it doesn’t ๐
Regards
Nik Hi Brajesh
Thank you and I did wonder if that should be the case.
I will look out for an update in due course.
Regards
Nik- NikB on November 29, 2022 at 8:09 am in reply to: [Resolved] BuddyBlog Pro – exclude from recent posts #47480
Hi 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
Nik - NikB on November 28, 2022 at 4:58 pm in reply to: [Resolved] BuddyBlog Pro – exclude from recent posts #47471
Hi 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.
Nik Hi 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
NikHi Brajesh
Thank you so much. I had a feeling that might be the code I needed. I already tried using it previously but that was before removing the Events Manager scope so of course, nothing was working at that stage!
What I’m actually hoping to do is filter out past events, which will require a query on the post meta but I’m used to working with WP_Query so that hopefully shouldn’t be a problem.
I really do appreciate all your help and patience, and hopefully won’t need to trouble you on this particular aspect again ๐
Regards
NikHi Brajesh
Sorry I didn’t read that example carefully enough, which I now realise relates to single posts (and where they appear), whereas what I was hoping for was some way of filtering/restricting the list of posts which appear under “Posts” (ie. posts.php) on a profile eg. let’s say there is a category called “blog” which I want to exclude completely from the list.
Note: I don’t need to change the permalink or make those posts show somewhere else but simply NOT show them in the list of posts on a (personal or group) profile.
Hope that makes a bit more sense
Regards
Nik