Support › MB Frontend Submission › Save multiple posts at once
I'm trying to build a calendar where users can reserve slots. Their choices get defined by other metaboxes, and Meta Box has so far performed admirably in tying everything together.
I'm going to get lots of data points with clearly defined structure, all of which need to be queried quickly, which leads me to think of a custom table, and in fact I've set one up, and it's working with frontend submission.
The tricky part is that I want to make adding events easy, and I'd like to facilitate adding more than one event at a time.
Your approach for creating cloneable groups of data is Meta Box Group. I like it, and putting together a group seems straightforward. But it gets stored as serialized data and isn't very accessible after the fact. So maybe not the best for custom tables.
Ideally, I want functionality similar to cloning field groups, while saving data as new rows in a custom table (i.e., a new post, yeah?)
How would you approach this issue?
If each event is a post, then you probably don't need Meta Box Group. Creating fields for events and saving them in the custom table is straight-forward. But that doesn't help you adding events fast.
I'm thinking about creating a custom page for entering data...
Yeah, I got as far as a single form on a front-facing page, saving the data in the custom table. (Incredibly straightforward, love this API.)
And I'm definitely expecting to code a custom page, so I can show a date's currently-scheduled events.
TBH I don't think they need to be multiple posts; that just seems simplest. But I've already noticed that I don't need any of the typical post information, only the custom field data. So it COULD be a bunch of meta info for one post. I mainly want to be sure I can query efficiently.
I may decide to only let the form input one at a time, and make sure it's done via AJAX so it's done fast enough that the user doesn't mind...
I may decide to only let the form input one at a time, and make sure it’s done via AJAX so it’s done fast enough that the user doesn’t mind…
Good idea. I didn't think about it.
If you go with event = post (with custom table), then you'll have 2 row in the DB. One in the posts table, which looks like a normal post. One in the custom table for event details. The custom table will help you query fast, while the default posts table helps you to have UI in the back end.