Activity::__construct( array $args = array() )
Description #
Initialize the activity class.
By default if no arguments are passed then all activities of site will be shown.
Parameters #
- $argsarray (Optional) Arguments.
- 'q_id'
(integer) Question id, to fetch activities only related to a specific question. - 'a_id'
(integer) Answer id, to fetch activities only related to a specific answer. - 'number'
(integer) Activities to show per page. - 'orderby'
(integer) name of column to order activities. Valid values are:activity_date
,activity_q_id
,activity_a_id
,activity_user_id
. - 'order'
(integer) Activity order.DESC
is default order.
- 'q_id'
Source #
File: includes/class/class-activity.php
public function __construct( $args = array() ) { $this->paged = isset( $args['paged'] ) ? (int) $args['paged'] : 1; $this->offset = $this->per_page * ( $this->paged - 1 ); $this->args = wp_parse_args( $args, array( 'number' => $this->per_page, 'offset' => $this->offset, 'orderby' => 'activity_date', 'order' => 'DESC', 'exclude_roles' => array( 'administrator' ), ) ); // Check if valid orderby argument. $valid_orderby = array( 'activity_q_id', 'activity_a_id', 'activity_c_id', 'activity_date' ); if ( ! in_array( $this->args['orderby'], $valid_orderby, true ) ) { $this->args['orderby'] = 'activity_date'; } $this->per_page = $this->args['number']; $this->query(); }
Expand full source code Collapse full source code View on GitHub: includes/class/class-activity.php:77
Add your comment