ap_get_all_reputation_events( array $args = array() )
Description #
Delete a reputation event by slug.
Parameters #
- $argsarray (Optional) Arguments. Default value: array()
Source #
File: includes/reputation.php
function ap_get_all_reputation_events( $args = array() ) { global $wpdb; $args = wp_parse_args( $args, array( 'order_by' => 'rep_events_id', 'order' => 'ASC', 'per_page' => 20, 'offset' => 0, ) ); extract( $args ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract $columns = array( 'rep_events_id', 'slug', 'label', 'points', 'parent' ); $order = 'ASC' === $args['order'] ? 'ASC' : 'DESC'; $order_by = sanitize_key( $order_by ); $order_by = in_array( $order_by, $columns, true ) ? $order_by : 'rep_events_id'; $per_page = (int) $per_page; $offset = $offset < 0 ? 0 : absint( $offset ); $order_st = $wpdb->prepare( "ORDER BY %s {$order}", $order_by ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared $limit_st = $per_page < 0 ? '' : "LIMIT $offset,$per_page"; $query = "SELECT * FROM $wpdb->ap_reputation_events WHERE 1=1 $order_st $limit_st"; $results = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB return $results; }
Expand full source code Collapse full source code View on GitHub: includes/reputation.php:464
Add your comment