- This topic has 2 replies, 2 voices, and was last updated 1 month, 1 week ago by .
I have come across this guide PHP MySQL Commenting System and I am trying to think of the best approach to re-building this into a custom table using Meta Box. The front end commenting system in this guide just creates threaded comments when viewing a specific post id and allows you to reply to comments. then stores the post id to retrieve them later and orders them by date. I do not want to use the default WordPress commenting system as custom fields is not supported in the front end.
1. My first idea was to create a 'custom table' and then use the rest of the logic in the guide and just replace PDO logic with WP Query etc and this should work fine. But my issue with this approach is that on the front end of the site I wont be able to use Meta Box fields? so defeats the object of using Meta Box. Also I would have to perform additional queries to retrieve the data from the custom table and output this as a separate script.
2. Another idea is to create a custom table like before but use Meta Box 'group fields', but then the fields will be stored as a 'serialized array' which is not a bad thing? but I'm just wondering will this be bad on a performance level with unserializing upon each page visit?
The positives is that I can just call the group field via the meta box helper function (as the comments have already been stored against the post id the user is currently viewing). The serialized array will be outputted and I guess I will then just save the form once the user has filled it in. My only concern is that if there is more than one user commenting at the same time then the data may get missed?.
Any pointers of alternative approaches would be greatly appreciated.
Also a side note on this topic is that if WordPresss core supported custom comment types (like how post types work) then I guess it would possibly help with developing a solution with metabox https://github.com/sc0ttkclark/wp-custom-comment-types
- You must be logged in to reply to this topic.