Notifications::load_more_notifications()
Description #
Ajax callback for loading more notifications.
Source #
File: addons/notifications/notifications.php
public 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\Notifications( array( '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' => array( '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/notifications/notifications.php:527
Add your comment