Skip to content

Reviews & Data Lifecycle Actions โ€‹

These fire when reviews, templates, widgets, and notifications are created, updated, or deleted. Ideal for syncing data to a CRM, invalidating your own caches, or logging.

wpsocialreviews/custom_review_created โ€‹

wpsocialreviews/custom_review_created โ€” A custom review was created

When it runs: Fires after a custom (manually added or form-submitted) review is saved. Fired by core's RecommendationsController and, in Pro, by the review-form submission handler and the WooCommerce product-review admin.

Parameters:

  • $review (WPSocialReviews\App\Models\Review): the newly created review model.

Source: app/Http/Controllers/Platforms/Reviews/RecommendationsController.php (core); Pro Services/ReviewForms/SubmissionHandler.php, WooProductAdmin.php

Usage:

php
add_action('wpsocialreviews/custom_review_created', function ($review) {
    if (empty($review->id)) {
        return;
    }
    // push the reviewer to a CRM audience
    my_crm_upsert_contact($review->reviewer_email, [
        'rating' => $review->rating,
        'source' => $review->platform_name,
    ]);
}, 10, 1);

wpsocialreviews/custom_review_updated โ€‹

wpsocialreviews/custom_review_updated โ€” A custom review was edited

When it runs: Fires after a custom review is edited โ€” including approve/unapprove, spam, and content edits.

Parameters:

  • $review (Review): the updated review model.

Source: RecommendationsController.php; Pro ProductReviews/ProductReviewPlatform.php

Usage:

php
add_action('wpsocialreviews/custom_review_updated', function ($review) {
    // keep an external mirror in sync
});

wpsocialreviews/custom_review_deleted โ€‹

wpsocialreviews/custom_review_deleted โ€” A custom review was removed

When it runs: fires after a custom review is deleted.

Parameters:

  • $review (Review): the deleted review model (read its data before it's gone).

Source: RecommendationsController.php

Usage:

php
add_action('wpsocialreviews/custom_review_deleted', function ($review) {
    my_crm_remove_review($review->review_id);
});

template_deleted ยท widget_deleted ยท notification_deleted โ€‹

wpsocialreviews/template_deleted / widget_deleted / notification_deleted โ€” An entity was deleted

When it runs: fires after a template, chat widget, or notification is deleted from the admin.

Parameters:

  • $id (int): the deleted entity ID.

Source: TemplatesController.php, WidgetsController.php, NotificationsController.php

Usage:

php
add_action('wpsocialreviews/template_deleted', function ($id) {
    // clean up any option keyed to this template id
    delete_option('my_addon_template_' . $id);
});

wpsocialreviews/before_delete_old_data โ€‹

wpsocialreviews/before_delete_old_data โ€” Old platform data is about to be pruned

When it runs: Fires before the plugin removes stale platform data (during sync/cleanup) in Platforms/PlatformData.php.

Parameters:

  • $id (int): the record about to be deleted.

Source: app/Services/Platforms/PlatformData.php

wpsocialreviews/template_meta_data โ€‹

wpsocialreviews/template_meta_data โ€” Template meta was saved

When it runs: fires when a reviews template's meta is stored.

Parameters:

  • $templateId (int): the template post ID.
  • $templateMeta (array): the saved meta.

Source: app/Http/Controllers/Platforms/Reviews/MetaController.php

Usage:

php
add_action('wpsocialreviews/template_meta_data', function ($templateId, $meta) {
    // react to template configuration changes
}, 10, 2);

Pro: review-form lifecycle โ€‹

Pro review-form actions โ€” submitted, created, updated, deleted, render, captcha

When they run: during review-form rendering and submission in WP Social Ninja Pro.

HookArgsFired at
wpsocialreviews/review_form_submitted$review, $formSubmissionHandler.php
wpsocialreviews/review_form_before_render$formFormRenderer.php
wpsocialreviews/review_form_after_fields$formFormRenderer.php
wpsocialreviews/review_form_created$formReviewFormController.php
wpsocialreviews/review_form_updated$formReviewFormController.php
wpsocialreviews/review_form_deleted$idReviewFormController.php
wpsocialreviews/review_form_captcha_failedcontext arrayCaptcha/CaptchaValidationService.php

Usage:

php
add_action('wpsocialreviews/review_form_submitted', function ($review, $form) {
    // notify a channel when a form review comes in
}, 10, 2);

WP Social Ninja Developer Documentation