Hook: mam_reviews_swipe_submitted

Signature

do_action( 'mam_reviews_swipe_submitted', array $swipe, ?array $result );
Parameter Type Description
$swipe array The swipe: post_id (int), user (WP_User), rating (0–5), like_status (like / dislike / skip).
$result array|null The provider’s save_review() result, or null when nothing was persisted (a skip, no target, or the user had already rated this listing).

When it fires

After the swipe-to-rate handler (mam_swipe_listing subaction) has processed a gesture:

  • On a like/dislike with a valid target, core saves the star rating through the owning provider (one per user per listing) and then fires this hook with the save $result.
  • On a skip, no target, or a duplicate (the user already rated that listing), core persists nothing and fires this hook with $result = null.

So the hook always fires once per swipe — letting consumers record every gesture, including skips, even when no native rating was written.


Example — store app-specific swipe data

add_action( 'mam_reviews_swipe_submitted', function ( array $swipe, ?array $result ) {
    $user_id = (int) $swipe['user']->ID;
    $post_id = (int) $swipe['post_id'];

    // e.g. build a per-user like/dislike set for recommendations
    $ratings = get_user_meta( $user_id, 'my_swipe_ratings', true ) ?: array();
    $ratings[ $post_id ] = array(
        'rating'      => (int) $swipe['rating'],
        'like_status' => $swipe['like_status'],
    );
    update_user_meta( $user_id, 'my_swipe_ratings', $ratings );
}, 10, 2 );

(MAM ABI Now uses this hook to keep per-user beer ratings in user meta alongside the native rating.)


Notes

  • The native star rating (when one was written) is already saved by the time this fires — this hook is for additional storage, not a replacement.
  • Check like_status if you want to treat skips differently from likes/dislikes; $result === null also signals “nothing persisted natively.”


Metadata

Field Value
Article type Hook Reference
Plugin slug mam-reviews-manager
Applies to plugin version 26.23.0+
Category Extending MAM Suite
Hook type action
Audience PHP developer
Last verified 2026-06-04
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!