Reputation::load_more_reputation()
Description #
Ajax callback for loading more reputations.
Source #
File: addons/reputation/reputation.php
public function load_more_reputation() { check_admin_referer( 'load_more_reputation', '__nonce' ); $user_id = ap_sanitize_unslash( 'user_id', 'r' ); $paged = ap_sanitize_unslash( 'current', 'r', 1 ) + 1; ob_start(); $reputations = new \AnsPress_Reputation_Query( array( 'user_id' => $user_id, 'paged' => $paged, ) ); while ( $reputations->have() ) : $reputations->the_reputation(); include ap_get_theme_location( 'addons/reputation/item.php' ); endwhile; $html = ob_get_clean(); $paged = $reputations->total_pages > $paged ? $paged : 0; ap_ajax_json( array( 'success' => true, 'args' => array( 'ap_ajax_action' => 'load_more_reputation', '__nonce' => wp_create_nonce( 'load_more_reputation' ), 'current' => (int) $paged, 'user_id' => $user_id, ), 'html' => $html, 'element' => '.ap-reputations tbody', ) ); }
Expand full source code Collapse full source code View on GitHub: addons/reputation/reputation.php:515
Add your comment