AnsPress_Reputation_Hooks::load_more_reputation()
Description #
Ajax callback for loading more reputations.
Source #
File: addons/free/reputation.php
public static 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( [ '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' => [ '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/free/reputation.php:436
Add your comment