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/dislikewith 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_statusif you want to treat skips differently from likes/dislikes;$result === nullalso signals “nothing persisted natively.”
Related articles
- Swipe to rate
- How reviews are stored and read (provider model)
- Hook:
mam_reviews_review_submitted
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 |
