ap_delete_reputation( string $event, integer $ref_id, integer|boolean $user_id = false )
Description #
Delete reputation by user_id and event.
Parameters #
- $eventstring (Required) Reputation event.
- $ref_idinteger (Required) Reference ID.
- $user_idinteger | boolean (Optional) User ID. Default value: false
Source #
File: includes/reputation.php
function ap_delete_reputation( $event, $ref_id, $user_id = false ) { global $wpdb; if ( false === $user_id ) { $user_id = get_current_user_id(); } $deleted = $wpdb->delete( // phpcs:ignore WordPress.DB $wpdb->ap_reputations, array( 'rep_user_id' => $user_id, 'rep_event' => sanitize_text_field( $event ), 'rep_ref_id' => $ref_id, ), array( '%d', '%s', '%d' ) ); if ( false === $deleted ) { return false; } // Update user meta. ap_update_user_reputation_meta( $user_id ); /** * Trigger action after deleting a reputation. */ do_action( 'ap_delete_reputation', $deleted, $user_id, $event ); return $deleted; }
Expand full source code Collapse full source code View on GitHub: includes/reputation.php:103
Add your comment