* @link http://dev.gaslightmedia.com/
*/
-/**
- * Require the Contact Data Class.
- */
-require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php';
-
-require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php';
-
/**
* Documentation for Wordpress API and adding custom endpoints.
* https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/
//$summary[] = $addon;
//}
+ $parameters = $request->get_params();
+ $summary['parameters'] = $parameters;
+ $addons= explode(",", $parameters['addons'] );
+ $summary['addons'] = $addons;
- if ( defined("GLM_MEMBERS_EVENTS_PLUGIN_PATH") ) {
+ $config = array();
- $config = array();
+ if ( in_array( 'events', $addons ) && defined("GLM_MEMBERS_EVENTS_PLUGIN_PATH") ) {
+ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php';
$events_summary = $this->get_events_summary( $config );
$summary['events'] = $events_summary;
$config['today'] = true;
$events_today = $this->get_events_summary( $config );
$summary['events_today'] = $events_today;
+
}
if ( defined("GLM_MEMBERS_EVENTS_PLUGIN_PATH") ) {
}
- if ( defined("GLM_MEMBERS_COUPONS_PLUGIN_PATH") ) {
- $summary['coupons'] = $this->get_coupons_summary();
+ if ( in_array( 'coupons', $addons ) && defined("GLM_MEMBERS_COUPONS_PLUGIN_PATH") ) {
+ $summary['coupons'] = $this->get_coupons_summary( $config );
}
- if ( defined("GLM_MEMBERS_PACKAGING_PLUGIN_PATH") ) {
- $summary['packaging'] = $this->get_packages_summary();
+ if ( in_array( 'packaging', $addons ) && defined("GLM_MEMBERS_PACKAGING_PLUGIN_PATH") ) {
+ $summary['packaging'] = $this->get_packaging_summary( $config );
}
- if ( defined("GLM_MEMBERS_PLUGIN_PATH") ) {
+ if ( in_array( 'members', $addons ) && defined("GLM_MEMBERS_PLUGIN_PATH") ) {
+ require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php';
// Cannot think of a reason to use members on home screen
//$members = $this->get_members_summary();
//$summary['members'] = $members;
return rest_ensure_response( get_object_vars ( (object) $summary ) );
},
+
+ 'args' => array(
+ 'eventsfeatured' => false
+ )
)
)
);
}
// Get members
- public function get_members_summary() {
+ public function get_members_summary( $config ) {
$fields = "id, name, member_slug";
$table = GLM_MEMBERS_PLUGIN_DB_PREFIX."members";
$where =
}
// Get coupons
- public function get_coupons_summary() {
+ public function get_coupons_summary( $config ) {
$fields = "id, name, name_slug, descr, image, start_date, end_date, expire";
$table = GLM_MEMBERS_COUPONS_PLUGIN_DB_PREFIX."coupons";
$where = "status IN (".$this->config['status_numb']['Active'].")
}
// Get packages
- public function get_packages_summary() {
+ public function get_packaging_summary( $config ) {
$fields = "id, title, package_slug, short_descr, image, start_date, end_date, expire_date";
$table = GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX."packages";
$where = "status IN (".$this->config['status_numb']['Active'].")