Skip to content

Instantly share code, notes, and snippets.

@sidharrell
Created October 15, 2013 15:13
Show Gist options
  • Save sidharrell/6993165 to your computer and use it in GitHub Desktop.
Save sidharrell/6993165 to your computer and use it in GitHub Desktop.
add filter by event creator
// THIS IS FOR 2.1 BETA
// in the espresso calendar object add..
/**
* @var INT $_event_user_id
* @access private
*/
private $_event_user_id = 0;
// in public function espresso_calendar( $atts ) {
$atts = shortcode_atts( $defaults, $atts );
if (!empty($atts['user_id'])) {
$this->_event_user_id = $atts['user_id'];
}
// in public function get_calendar_events() {
$SQL .= "WHERE e.is_active != 'N' ";
if (!empty($this->_event_user_id)) {
$SQL .= " AND e.wp_user=" . $this->_event_user_id;
}
// THIS IS FOR 2.0.6.2
// add to function espresso_calendar($atts) {
// starting at line 460
extract(shortcode_atts(array('event_category_id' => '', 'show_expired' => false, 'cal_view' => 'month', 'wp_user_id'=>0), $atts));
$event_category_id = "{$event_category_id}";
if (!empty($wp_user_id)) {
$espresso_calendar['wp_user_id'] = $wp_user_id;
}
// add this same section before line 230:
if (!empty($espresso_calendar['wp_user_id'])) {
$sql .= " AND e.wp_user=" . $espresso_calendar['wp_user_id'];
}
$sql .= " AND e.event_status != 'D' ";//Deleted
// and before line 204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment