ap_delete_subscriber( integer $ref_id, integer $user_id, string $event )

Description #

Delete a single subscriber.

This is a preferred function for deleting a subscriber. Avoid using function @see ap_delete_subscribers().

Parameters #

  • $ref_id
    integer (Required) Reference id.
  • $user_id
    integer (Required) User id.
  • $event
    string (Required) Event type.

Changelog #

VersionDescription
4.1.5Introduced.

Source #

File: includes/subscribers.php

function ap_delete_subscriber( $ref_id, $user_id, $event ) {
	global $wpdb;

	$rows = $wpdb->delete( // phpcs:ignore WordPress.DB
		$wpdb->ap_subscribers,
		array(
			'subs_ref_id'  => $ref_id,
			'subs_user_id' => $user_id,
			'subs_event'   => $event,
		),
		array( '%d', '%d', '%s' )
	);

	if ( false !== $rows ) {
		/**
		 * Action triggered right after deleting a single subscriber.
		 *
		 * @param integer $ref_id  Reference id.
		 * @param integer $user_id User id.
		 * @param string  $event   Event type.
		 */
		do_action( 'ap_delete_subscriber', $ref_id, $user_id, $event );

		return true;
	}

	return false;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment