AnsPress_Notification_Hook::load_more_notifications()
Description #
Ajax callback for loading more notifications.
Source #
File: addons/free/notification.php
public static function load_more_notifications() { check_admin_referer( 'load_more_notifications', '__nonce' ); $user_id = ap_sanitize_unslash( 'user_id', 'r' ); $paged = ap_sanitize_unslash( 'current', 'r', 1 ) + 1; ob_start(); $notifications = new AnsPress_Notification_Query( [ 'user_id' => $user_id, 'paged' => $paged ] ); while ( $notifications->have() ) : $notifications->the_notification(); $notifications->item_template(); endwhile; $html = ob_get_clean(); $paged = $notifications->total_pages > $paged ? $paged : 0; ap_ajax_json( array( 'success' => true, 'args' => [ 'ap_ajax_action' => 'load_more_notifications', '__nonce' => wp_create_nonce( 'load_more_notifications' ), 'current' => (int) $paged, 'user_id' => $user_id ], 'html' => $html, 'element' => '.ap-noti', ) ); }
Expand full source code Collapse full source code View on GitHub: addons/free/notification.php:459
Add your comment