BP_Notifications_Notification::get_paged_sql( array $args = array() )
Assemble the LIMIT clause of a get() SQL statement.
Description
Used by BP_Notifications_Notification::get() to create its LIMIT clause.
Parameters
- $args
-
(Optional) See BP_Notifications_Notification::get() for more details.
Default value: array()
Return
(string) $retval LIMIT clause.
Source
File: bp-notifications/classes/class-bp-notifications-notification.php
protected static function get_paged_sql( $args = array() ) {
global $wpdb;
// Setup local variable.
$retval = '';
// Custom LIMIT.
if ( ! empty( $args['page'] ) && ! empty( $args['per_page'] ) ) {
$page = absint( $args['page'] );
$per_page = absint( $args['per_page'] );
$offset = $per_page * ( $page - 1 );
$retval = $wpdb->prepare( "LIMIT %d, %d", $offset, $per_page );
}
return $retval;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.9.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.