ap_delete_subscribers( array $where, string $event = null, integer $ref_id = null, integer $user_id = null )
Description #
Delete subscribers by event, ref_id and user_id.
This is not a recommended function to delete subscriber as this function does not properly handles hooks. Instead use @see ap_delete_subscriber().
Parameters #
- $wherearray (Required) Where clauses.
- 'subs_event'
(string) Event type. - 'subs_ref_id'
(integer) Reference id. - 'subs_user_id'
(integer) User id.
- 'subs_event'
$event
string (Optional) Deprecated. Default value: null$ref_id
integer (Optional) Deprecated. Default value: null$user_id
integer (Optional) Deprecated. Default value: nullSource #
File: includes/subscribers.php
function ap_delete_subscribers( $where, $event = null, $ref_id = null, $user_id = null ) { if ( null !== $event || null !== $ref_id || null !== $user_id ) { _deprecated_argument( __FUNCTION__, '4.1.5', esc_attr__( 'All 3 arguments $event, $ref_id and $user_id are deprecated.', 'anspress-question-answer' ) ); } global $wpdb; $where = wp_array_slice_assoc( $where, array( 'subs_event', 'subs_ref_id', 'subs_user_id' ) ); // Return if where clauses are empty. if ( empty( $where ) ) { return; } /** * Action triggered right after deleting subscribers. * * @param string $where $where { * Where clauses. * * @type string $subs_event Event type. * @type integer $subs_ref_id Reference id. * @type integer $subs_user_id User id. * } * * @category haveTest * * @since 4.1.5 */ do_action( 'ap_before_delete_subscribers', $where ); $rows = $wpdb->delete( $wpdb->ap_subscribers, $where ); // phpcs:ignore WordPress.DB if ( false !== $rows ) { $ref_id = isset( $where['subs_ref_id'] ) ? $where['subs_ref_id'] : 0; $event = isset( $where['subs_event'] ) ? $where['subs_event'] : ''; /** * Action triggered right after deleting subscribers. * * @param integer $rows Number of rows deleted. * @param string $where $where { * Where clauses. * * @type string $subs_event Event type. * @type integer $subs_ref_id Reference id. * @type integer $subs_user_id User id. * } * * @since 4.0.0 */ do_action( 'ap_delete_subscribers', $rows, $where ); } return $rows; }
Expand full source code Collapse full source code View on GitHub: includes/subscribers.php:219
Add your comment