Replies
- NikB on September 2, 2022 at 11:54 am in reply to: [Resolved] BuddyBlog Pro – Custom field types #46293
Hi Brajesh
I’ve made a start on attempting to update my Event custom post type postmeta by creating a custom field (my_date) on the relevant form and then using the code below but for some reason, it doesn’t seem to be picking up a value for $_POST[‘my_date’].
This doesn’t seem to be anything to do with the field type as I’ve tried changing it to a text field and that doesn’t seem to make any difference. Indeed, if I run the same code but using $_POST[‘bbl_post_title’] then everything works fine (even if it doesn’t make much sense!) so this seems to be an issue with custom fields only…
Could it be something to do with the fact taht the field name actually seems to appear as “bbl_custom_field[my_date]” (ie. including square brackets in the name itself) so possibly I need to reference it slightly differently?
Here’s the code I’ve tried so far…
` add_filter( ‘bblpro_post_submission_prepared_data’, function ( $post_data, $form_id, $post, $is_submission ) {
if ( 2487 === (int) $form_id ) {
$mydate = $_POST[‘my_date’] . ‘ 11:00:00’;
//$mydate = $_POST[‘bbl_custom_field[my_date]’] . ‘ 11:00:00’;if ( ! empty( $post_data[‘ID’] ) ) {
update_post_meta( $post_data[‘ID’], ‘_EventStartDate’, $mydate);}
}return $post_data;
}, 10, 4 ); `With many thanks in advance for any thoughts.
Nik - NikB on September 1, 2022 at 6:56 pm in reply to: [Resolved] BuddyBlog Pro – Custom field types #46287
Thank you so much Brajesh. That’s exactly the kind of info I needed… I’ll take a look.
Regards
Nik - NikB on September 1, 2022 at 7:43 am in reply to: [Resolved] BuddyBlog Pro – Custom field types #46267
Hi Brajesh
Just wanted to add that having just discovered the ‘bblpro_post_submission_prepared_data’ filter, it looks as if it would be relatively easy for me to combine a time field (such as that which you suggested above) with the existing date field in order to save the postmeta in a suitable format for my events plugin.
In other words, if implementing the above time field would be a relatively “quick fix” as compared to implementing a full date/time field, that would certainly be perfectly acceptable for my purposes at this stage… and if it’s something I can implement myself (with a little guidance from you) even better…
No worries if not though… the groups functionality is far more of a priority for me at least and hope that’s all going well.
Regards
Nik Many thanks Brajesh. Although I do understand these things take time, I must admit, timing is starting to be quite critical for me now so fingers crossed all goes well and it won’t be too much longer.
Incidentally don’t want to take up any more of your time than necessary, but can you just confirm that once complete, users will be able to create their posts from within groups (rather than posting from their profiles and having to select the group in which they want it posted)?
Regards
NikHey Brajesh
Sorry to ask again but just wondering how things are progressing with this?
Regards
Nik- NikB on August 29, 2022 at 10:26 am in reply to: [Resolved] BuddyBlog Pro – Custom field types #46208
Hi Brajesh
Many thanks for considering this. Although not ideal, I guess I MAY be able to get around it temporarily by using text fields and instructing the users to use a particular format when entering their date/time (and just hope the users actually read and follow the instructions) but if/when you have time, a date/time field would definitely be useful and very much appreciated.
Regards
Nik Thank you Brajesh. I’ve got it now and that all makes sense.
Thank you also for explaining re. post specific overrides as that would probably have been my next question.
Regards
Nik- NikB on August 26, 2022 at 5:35 pm in reply to: [Resolved] BuddyBlog Pro – Custom field types #46185
Hi Brajesh
Thank you and that certainly looks promising.
Although actually I’ve just checked the postmeta for the events plugin I’m currently testing and unfortunately it seems to store the start date/time in the same field in the format “2022-08-31 08:00:00” that said… perhaps there is some way I could combine a BuddyBlog Pro date field along with a time field prior to saving, in order to produce the relevant string for the meta?
Regards
Nik Update: after further investigation, it seems that the correct template path for my theme (which isn’t any of those included with BuddyBlog Pro eg. BuddyBoss, Kleo etc) needs to be… mychildtheme/buddyblog/default/default/posts.php.
This feels a bit clunky but since it works, I’ll assume I’m on the right path unless you would advise otherwise Brajesh?
Regards
NikHi Brajesh
Well OK… in that case, I will go ahead and purchase BuddyBlog Pro and start familiarising myself with *that* instead… and cross fingers that the BuddyBlog Group won’t be too far behind 😉
Good luck with the testing and thank you again for the wonderful support.
Nik