Import existing reviews
-
Do you have a data schema for existing reviews to import them into Site Review?
-
The custom post_type is: site-review
Each review has the following meta_keys:- author
- assigned_to
- avatar
- content
- date
- ip_address
- pinned
- rating
- review_id
- review_type
- title
- url
Thanks – further questions!
1. where is the category assigned?
2. is the review_id auto-created on import or is it predefined in the import file?
ChrisThe custom taxonomy is: site-review-category
You set the category with: wp_set_object_terms
The default review_type is: local
The review_id meta_value is autogenerated: md5( time().serialize( $meta ))
The data meta_value is autogenerated: get_date_from_gmt( gmdate( ‘Y-m-d H:i:s’ ))Site Reviews does not yet officially support importing 3rd-party reviews.
-
This reply was modified 7 years ago by
Gemini Labs.
Hi is there a way of automating the transfer of review data captured on another form (InboundNow) into Site Review.
The website is a small group of dental practices and as part of their clinical service feedback they are required to capture more data than is easily possible in Site Review but only need to publish the star rating, overall comments and initials of the reviewer.
The category relates to the location of each of the dental practices within the group.
Ideally, I would like to run a cron job or something similar to automatically copy a subset of the review data completed in InboundNow form into the Site Review structure.
See: https://www.spadental.co.uk/plymouth/feedback/ for data collected.
Do you know of either:
1. plugin that can do the above; or
2. how easy would it to be to write a script to do the above?Thanks
ChrisI don’t know of any plugin that does what you are asking. It’s not that difficult to write some code to do this, but it is a little bit outside of the scope of support that I provide for a free plugin.
However, I have gone ahead and put something together for you that may help you to come up with your own solution: https://github.com/geminilabs/site-reviews/wiki/How-to-manually-create-a-review
I hope this is helpful.
Thanks, looks like that might work just need to work out how to populate it with data from the InboundForm.
Will investigate InboundForm automation rules which get triggered on the form completion.I am sure there is a more elegant way of doing it but beyond my knowledge!
Thanks
ChrisHi Paul,
Would it possible to add the date in to the function “createSiteReview”?
I am importing reviews for the last three months and would like to give them their actual date rather than them all being dated today.
Thanks
ChrisJust add the date to the review data that you pass to the function:
'date' => gmdate( 'Y-m-d H:i:s', strtotime( '22-09-2008' )),
-
This reply was modified 7 years ago by
Gemini Labs.
-
This reply was modified 7 years ago by
Gemini Labs.
Having just imported all 165 reviews, I have just realised there is no BULK Action to approve multiple Reviews in one go: is there also a create variable to set the Review as Approved?
Approved/Unapproved is exactly the same as the Published/Pending post status.
Simply bulk-edit change the status to “Published” to bulk approve reviews.
Thanks @hudson-atwell
I imagine then using the example function I provided earlier, it would look something like this:
/** * Create a review from the information submitted from the Inbound Forms plugin form * @param array $postData * @param array $postMeta * @return void */ add_action( 'inboundnow_form_submit_actions', function( $postData, $metaData ) { // If you enable debugging in the Site Reviews "Get Help -> System Info" page, you can use the "glsr_log" function to log variables. For example: glsr_log( $postData ); glsr_log( $metaData ); // Here you create the review based on the values of $postData and $postMeta: // createSiteReview([ // 'author' => $postMeta['author'], // 'email' => $postMeta['email'], // 'content' => $postData['content'], // 'rating' => $postMeta['rating'], // 'title' => $postData['title'], // ]); }, 10, 2 );
Heya @geminilabs,
Looking at it. It should work. I usually hook a little later in inbound_store_lead_post, but I think your hook might be better suited if the form submission data isn’t mapped. The inbound_store_lead_post hook may filter out some of the raw post data. I can’t be for sure without running some tests. It definitely carries over mapped data.
More information about data mapping:
https://docs.inboundnow.com/guide/map-inbound-now-form-fields/Where ever the glsr_log() function outputs it’s data will tell use the full capability of the hook. If all the information you need is in there then you’re good to go with programming an integration.
Kind regards,
Hudson Atwell-
This reply was modified 7 years ago by
Hudson Atwell.
-
This reply was modified 7 years ago by
Hudson Atwell.
Hi @geminilabs
Apologies not had time to look at adding the date functionality into the createSiteReview function until now (had to do the day job!):
1. The import works perfectly and the Review is created with the correct date, but
2. When the review is Approved (Published) the date of the review is changed to today’s date.Is there a way of setting the Review as Approved (Published) on import and using the date passed as part of the createSiteReview function?
I have not tested it but I assume that unless you manually change the Publish date, the Approval process changes the date of the Review created by the reviewer to the date the Administrator Approves the Review?
Thanks
ChrisI have updated the createSiteReview function in the link above. Please update Site Reviews to the latest version and then change the createSiteReview function to the updated one.
Also, make sure the “require approval” option in Site Reviews setting is disabled, otherwise that will change the status when a review is created to “pending”.
If you pass the date to the “createSiteReview” function it will use that date as the published date.
i.e.
createSiteReview([ 'date' => gmdate( 'Y-m-d H:i:s', strtotime( '22-09-2008' )), ]);
-
This reply was modified 7 years ago by
Gemini Labs.
-
This reply was modified 7 years ago by
Gemini Labs.
Hi @geminilabs
I have already updated to version 2.13.1 : correct?
I have just looked at the latest version (updated 9 minutes ago – 6 revisions) of
https://github.com/geminilabs/site-reviews/wiki/How-to-manually-create-a-reviewit appears to have the date variable missing that you asked me to add:
‘date’ => gmdate( ‘Y-m-d H:i:s’, strtotime( ’22-09-2008′ )),
I assume I need to add it?
Thanks for the pointer to “require approval” – ours is set to requiring approval.
I will try it again shortly.
-
This reply was modified 7 years ago by
Christopher Hilling.
- The topic ‘Import existing reviews’ is closed to new replies.