Reputation::ap_save_events()
Description #
Save reputation events.
Source #
File: addons/reputation/reputation.php
public function ap_save_events() { check_ajax_referer( 'ap-save-events', '__nonce' ); if ( ! current_user_can( 'manage_options' ) ) { wp_die(); } $events_point = ap_isset_post_value( 'events', 'r' ); $points = array(); foreach ( ap_get_reputation_events() as $slug => $event ) { if ( isset( $events_point[ $slug ] ) ) { $points[ sanitize_text_field( $slug ) ] = (int) $events_point[ $slug ]; } } if ( ! empty( $points ) ) { update_option( 'anspress_reputation_events', $points ); } echo '<div class="notice notice-success is-dismissible"><p>' . esc_attr__( 'Successfully updated reputation points!', 'anspress-question-answer' ) . '</p></div>'; wp_die(); }
Expand full source code Collapse full source code View on GitHub: addons/reputation/reputation.php:260
Add your comment