/**
  * Gets the bookings for this object instance according to its settings
  * @param boolean $force_refresh
  * @return EM_Bookings
  */
 function get_bookings($force_refresh = true)
 {
     if (empty($this->bookings) || $force_refresh) {
         $this->events = array();
         $EM_Ticket = $this->get_ticket();
         $EM_Event = $this->get_event();
         $EM_Person = $this->get_person();
         if ($EM_Person !== false) {
             $args = array('person' => $EM_Person->ID, 'scope' => $this->scope, 'status' => $this->get_status_search(), 'order' => $this->order, 'orderby' => $this->orderby);
             $this->bookings_count = EM_Bookings::count($args);
             $this->bookings = EM_Bookings::get(array_merge($args, array('limit' => $this->limit, 'offset' => $this->offset)));
             foreach ($this->bookings->bookings as $EM_Booking) {
                 //create event
                 if (!array_key_exists($EM_Booking->event_id, $this->events)) {
                     $this->events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
                 }
             }
         } elseif ($EM_Ticket !== false) {
             //searching bookings with a specific ticket
             $args = array('ticket_id' => $EM_Ticket->ticket_id, 'order' => $this->order, 'orderby' => $this->orderby);
             $this->bookings_count = EM_Bookings::count($args);
             $this->bookings = EM_Bookings::get(array_merge($args, array('limit' => $this->limit, 'offset' => $this->offset)));
             $this->events[$EM_Ticket->event_id] = $EM_Ticket->get_event();
         } elseif ($EM_Event !== false) {
             //bookings for an event
             $args = array('event' => $EM_Event->event_id, 'scope' => false, 'status' => $this->get_status_search(), 'order' => $this->order, 'orderby' => $this->orderby);
             $args['owner'] = !current_user_can('manage_others_bookings') ? get_current_user_id() : false;
             $this->bookings_count = EM_Bookings::count($args);
             $this->bookings = EM_Bookings::get(array_merge($args, array('limit' => $this->limit, 'offset' => $this->offset)));
             $this->events[$EM_Event->event_id] = $EM_Event;
         } else {
             //all bookings for a status
             $args = array('status' => $this->get_status_search(), 'scope' => $this->scope, 'order' => $this->order, 'orderby' => $this->orderby);
             $args['owner'] = !current_user_can('manage_others_bookings') ? get_current_user_id() : false;
             $this->bookings_count = EM_Bookings::count($args);
             $this->bookings = EM_Bookings::get(array_merge($args, array('limit' => $this->limit, 'offset' => $this->offset)));
             //Now let's create events and bookings for this instead of giving each booking an event
             foreach ($this->bookings->bookings as $EM_Booking) {
                 //create event
                 if (!array_key_exists($EM_Booking->event_id, $this->events)) {
                     $this->events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
                 }
             }
         }
     }
     return $this->bookings;
 }
Exemplo n.º 2
0
function em_create_events_submenu()
{
    if (function_exists('add_submenu_page')) {
        //Count pending bookings
        $num = '';
        if (get_option('dbem_bookings_approval') == 1) {
            $bookings_pending_count = count(EM_Bookings::get(array('status' => 0)));
            //TODO Add flexible permissions
            if ($bookings_pending_count > 0) {
                $num = '<span class="update-plugins count-' . $bookings_pending_count . '"><span class="plugin-count">' . $bookings_pending_count . '</span></span>';
            }
        }
        add_object_page(__('Events', 'dbem'), __('Events', 'dbem') . $num, EM_MIN_CAPABILITY, 'events-manager', 'em_admin_events_page', '../wp-content/plugins/events-manager/includes/images/calendar-16.png');
        // Add a submenu to the custom top-level menu:
        $plugin_pages = array();
        $plugin_pages[] = add_submenu_page('events-manager', __('Edit'), __('Edit'), EM_MIN_CAPABILITY, 'events-manager', 'em_admin_events_page');
        $plugin_pages[] = add_submenu_page('events-manager', __('Add new', 'dbem'), __('Add new', 'dbem'), EM_MIN_CAPABILITY, 'events-manager-event', "em_admin_event_page");
        if (get_option('dbem_permissions_locations') != 1 || em_verify_admin()) {
            $plugin_pages[] = add_submenu_page('events-manager', __('Locations', 'dbem'), __('Locations', 'dbem'), EM_MIN_CAPABILITY, 'events-manager-locations', "em_admin_locations_page");
        }
        if (get_option('dbem_rsvp_enabled') == 1) {
            $plugin_pages[] = add_submenu_page('events-manager', __('Bookings', 'dbem'), __('Bookings', 'dbem') . $num, EM_MIN_CAPABILITY, 'events-manager-bookings', "em_bookings_page");
        }
        if (get_option('dbem_permissions_categories') != 1 || em_verify_admin()) {
            $plugin_pages[] = add_submenu_page('events-manager', __('Event Categories', 'dbem'), __('Categories', 'dbem'), EM_MIN_CAPABILITY, "events-manager-categories", 'em_admin_categories_page');
        }
        $plugin_pages[] = add_submenu_page('events-manager', __('Events Manager Settings', 'dbem'), __('Settings', 'dbem'), EM_SETTING_CAPABILITY, "events-manager-options", 'em_admin_options_page');
        $plugin_pages[] = add_submenu_page('events-manager', __('Getting Help for Events Manager', 'dbem'), __('Help', 'dbem'), EM_SETTING_CAPABILITY, "events-manager-help", 'em_admin_help_page');
        foreach ($plugin_pages as $plugin_page) {
            add_action('admin_print_scripts-' . $plugin_page, 'em_admin_load_scripts');
            add_action('admin_head-' . $plugin_page, 'em_admin_general_script');
            add_action('admin_print_styles-' . $plugin_page, 'em_admin_load_styles');
        }
    }
}
Exemplo n.º 3
0
function em_admin_menu()
{
    global $menu, $submenu, $pagenow;
    //Count pending bookings
    if (get_option('dbem_rsvp_enabled')) {
        $bookings_num = '';
        $bookings_pending_count = apply_filters('em_bookings_pending_count', 0);
        if (get_option('dbem_bookings_approval') == 1) {
            $bookings_pending_count += count(EM_Bookings::get(array('status' => '0', 'blog' => get_current_blog_id()))->bookings);
        }
        if ($bookings_pending_count > 0) {
            $bookings_num = '<span class="update-plugins count-' . $bookings_pending_count . '"><span class="plugin-count">' . $bookings_pending_count . '</span></span>';
        }
    } else {
        $bookings_num = '';
        $bookings_pending_count = 0;
    }
    //Count pending events
    $events_num = '';
    $events_pending_count = EM_Events::count(array('status' => 0, 'scope' => 'all', 'blog' => get_current_blog_id()));
    //TODO Add flexible permissions
    if ($events_pending_count > 0) {
        $events_num = '<span class="update-plugins count-' . $events_pending_count . '"><span class="plugin-count">' . $events_pending_count . '</span></span>';
    }
    //Count pending recurring events
    $events_recurring_num = '';
    $events_recurring_pending_count = EM_Events::count(array('status' => 0, 'recurring' => 1, 'scope' => 'all', 'blog' => get_current_blog_id()));
    //TODO Add flexible permissions
    if ($events_recurring_pending_count > 0) {
        $events_recurring_num = '<span class="update-plugins count-' . $events_recurring_pending_count . '"><span class="plugin-count">' . $events_recurring_pending_count . '</span></span>';
    }
    $both_pending_count = apply_filters('em_items_pending_count', $events_pending_count + $bookings_pending_count + $events_recurring_pending_count);
    $both_num = $both_pending_count > 0 ? '<span class="update-plugins count-' . $both_pending_count . '"><span class="plugin-count">' . $both_pending_count . '</span></span>' : '';
    // Add a submenu to the custom top-level menu:
    $plugin_pages = array();
    if (get_option('dbem_rsvp_enabled')) {
        $plugin_pages['bookings'] = add_submenu_page('edit.php?post_type=' . EM_POST_TYPE_EVENT, __('Bookings', 'events-manager'), __('Bookings', 'events-manager') . $bookings_num, 'manage_bookings', 'events-manager-bookings', "em_bookings_page");
    }
    $plugin_pages['options'] = add_submenu_page('edit.php?post_type=' . EM_POST_TYPE_EVENT, __('Events Manager Settings', 'events-manager'), __('Settings', 'events-manager'), 'manage_options', "events-manager-options", 'em_admin_options_page');
    $plugin_pages['help'] = add_submenu_page('edit.php?post_type=' . EM_POST_TYPE_EVENT, __('Getting Help for Events Manager', 'events-manager'), __('Help', 'events-manager'), 'manage_options', "events-manager-help", 'em_admin_help_page');
    //If multisite global with locations set to be saved in main blogs we can force locations to be created on the main blog only
    if (EM_MS_GLOBAL && !is_main_site() && get_site_option('dbem_ms_mainblog_locations')) {
        include dirname(__FILE__) . "/em-ms-locations.php";
        $plugin_pages['locations'] = add_submenu_page('edit.php?post_type=' . EM_POST_TYPE_EVENT, __('Locations', 'events-manager'), __('Locations', 'events-manager'), 'read_others_locations', "locations", 'em_admin_ms_locations');
    }
    $plugin_pages = apply_filters('em_create_events_submenu', $plugin_pages);
    //We have to modify the menus manually
    if (!empty($both_num)) {
        //Main Event Menu
        //go through the menu array and modify the events menu if found
        foreach ((array) $menu as $key => $parent_menu) {
            if ($parent_menu[2] == 'edit.php?post_type=' . EM_POST_TYPE_EVENT) {
                $menu[$key][0] = $menu[$key][0] . $both_num;
                break;
            }
        }
    }
    if (!empty($events_num) && !empty($submenu['edit.php?post_type=' . EM_POST_TYPE_EVENT])) {
        //Submenu Event Item
        //go through the menu array and modify the events menu if found
        foreach ((array) $submenu['edit.php?post_type=' . EM_POST_TYPE_EVENT] as $key => $submenu_item) {
            if ($submenu_item[2] == 'edit.php?post_type=' . EM_POST_TYPE_EVENT) {
                $submenu['edit.php?post_type=' . EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type=' . EM_POST_TYPE_EVENT][$key][0] . $events_num;
                break;
            }
        }
    }
    if (!empty($events_recurring_num) && !empty($submenu['edit.php?post_type=' . EM_POST_TYPE_EVENT])) {
        //Submenu Recurring Event Item
        //go through the menu array and modify the events menu if found
        foreach ((array) $submenu['edit.php?post_type=' . EM_POST_TYPE_EVENT] as $key => $submenu_item) {
            if ($submenu_item[2] == 'edit.php?post_type=event-recurring') {
                $submenu['edit.php?post_type=' . EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type=' . EM_POST_TYPE_EVENT][$key][0] . $events_recurring_num;
                break;
            }
        }
    }
    /* Hack! Add location/recurrence isn't possible atm so this is a workaround */
    global $_wp_submenu_nopriv;
    if ($pagenow == 'post-new.php' && !empty($_REQUEST['post_type'])) {
        if ($_REQUEST['post_type'] == EM_POST_TYPE_LOCATION && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_locations')) {
            unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
        }
        if ($_REQUEST['post_type'] == 'event-recurring' && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_recurring_events')) {
            unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
        }
    }
}
Exemplo n.º 4
0
/**
 * Generates a "widget" table of pending bookings with some quick admin operation options. 
 * If event id supplied then only pending bookings for that event will show.
 * 
 * @param int $event_id
 */
function em_bookings_pending_table($event_id = false)
{
    global $EM_Event, $wpdb, $current_user;
    if (get_option('dbem_bookings_approval') == 0) {
        return false;
    }
    $action_scope = !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_pending_table';
    $action = $action_scope && !empty($_GET['action']) ? $_GET['action'] : '';
    $order = $action_scope && !empty($_GET['order']) ? $_GET['order'] : 'ASC';
    $limit = $action_scope && !empty($_GET['limit']) ? $_GET['limit'] : 20;
    //Default limit
    $page = $action_scope && !empty($_GET['pno']) ? $_GET['pno'] : 1;
    $offset = $action_scope && $page > 1 ? ($page - 1) * $limit : 0;
    if (is_object($EM_Event)) {
        $bookings = $EM_Event->get_bookings()->get_pending();
    } else {
        //To optimize performance, we can do one query here for all pending bookings to show.
        $bookings = EM_Bookings::get(array('status' => 0));
        $events = array();
        //Now let's create events and bookings for this:
        foreach ($bookings as $EM_Booking) {
            //create event
            if (!array_key_exists($EM_Booking->event_id, $events)) {
                $events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
            }
        }
    }
    $bookings_count = is_array($bookings) ? count($bookings) : 0;
    ?>
		<div class='wrap em_bookings_pending_table em_obj'>
			<form id='bookings-filter' method='get' action='<?php 
    bloginfo('wpurl');
    ?>
/wp-admin/edit.php'>
				<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
				<!--
				<ul class="subsubsub">
					<li>
						<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
					</li>
				</ul>
				<p class="search-box">
					<label class="screen-reader-text" for="post-search-input"><?php 
    _e('Search');
    ?>
:</label>
					<input type="text" id="post-search-input" name="em_search" value="<?php 
    echo !empty($_GET['em_search']) ? $_GET['em_search'] : '';
    ?>
" />
					<input type="submit" value="<?php 
    _e('Search');
    ?>
" class="button" />
				</p>
				-->
				<?php 
    if ($bookings_count >= $limit) {
        ?>
				<div class='tablenav'>
					<!--
					<div class="alignleft actions">
						<select name="action">
							<option value="-1" selected="selected">
								<?php 
        _e('Bulk Actions');
        ?>
							</option>
							<option value="approve">
								<?php 
        _e('Approve', 'dbem');
        ?>
							</option>
							<option value="decline">
								<?php 
        _e('Decline', 'dbem');
        ?>
							</option>
						</select> 
						<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
					</div>
					-->
					<!--
					<div class="view-switch">
						<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
					</div>
					-->
					<?php 
        if ($bookings_count >= $limit) {
            $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], array('pno' => '%PAGE%', 'em_ajax' => 0, 'em_obj' => 'em_bookings_pending_table'));
            $bookings_nav = em_admin_paginate($page_link_template, $bookings_count, $limit, $page, 5);
            echo $bookings_nav;
        }
        ?>
					<div class="clear"></div>
				</div>
				<?php 
    }
    ?>
				<div class="clear"></div>
				<?php 
    if ($bookings_count > 0) {
        ?>
				<div class='table-wrap'>
				<table id='dbem-bookings-table' class='widefat post fixed'>
					<thead>
						<tr>
							<th class='manage-column column-cb check-column' scope='col'>
								<input class='select-all' type="checkbox" value='1' />
							</th>
							<th class='manage-column' scope='col'>Booker</th>
							<?php 
        if (!is_object($EM_Event)) {
            ?>
							<th class='manage-column' scope="col">Event</th>
							<?php 
        }
        ?>
							<th class='manage-column' scope='col'>E-mail</th>
							<th class='manage-column' scope='col'>Phone number</th>
							<th class='manage-column' scope='col'>Spaces</th>
							<th class='manage-column' scope='col'>&nbsp;</th>
						</tr>
					</thead>
					<tbody>
						<?php 
        $rowno = 0;
        $event_count = 0;
        foreach ($bookings as $EM_Booking) {
            if (($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0)) {
                $rowno++;
                ?>
								<tr>
									<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php 
                echo $EM_Booking->id;
                ?>
' name='bookings[]'/></th>
									<td><a href="<?php 
                bloginfo('wpurl');
                ?>
/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php 
                echo $EM_Booking->person->id;
                ?>
"><?php 
                echo $EM_Booking->person->name;
                ?>
</a></td>
									<?php 
                if (!is_object($EM_Event)) {
                    ?>
									<td><a href="<?php 
                    bloginfo('wpurl');
                    ?>
/wp-admin/admin.php?page=events-manager-bookings&amp;event_id=<?php 
                    echo $EM_Booking->event_id;
                    ?>
"><?php 
                    echo $events[$EM_Booking->event_id]->name;
                    ?>
</a></td>
									<?php 
                }
                ?>
									<td><?php 
                echo $EM_Booking->person->email;
                ?>
</td>
									<td><?php 
                echo $EM_Booking->person->phone;
                ?>
</td>
									<td><?php 
                echo $EM_Booking->seats;
                ?>
</td>
									<td>
										<?php 
                $approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'bookings_approve', 'booking_id' => $EM_Booking->id));
                $reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'bookings_reject', 'booking_id' => $EM_Booking->id));
                ?>
										<a class="em-bookings-approve" href="<?php 
                echo $approve_url;
                ?>
"><?php 
                _e('Approve', 'dbem');
                ?>
</a> |
										<a class="em-bookings-reject" href="<?php 
                echo $reject_url;
                ?>
"><?php 
                _e('Reject', 'dbem');
                ?>
</a> |
										<a class="em-bookings-edit" href="<?php 
                bloginfo('wpurl');
                ?>
/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php 
                echo $EM_Booking->id;
                ?>
"><?php 
                _e('Edit');
                ?>
</a>
									</td>
								</tr>
								<?php 
            }
            $event_count++;
        }
        ?>
					</tbody>
				</table>
				</div>
				<?php 
    } else {
        ?>
					<?php 
        _e('No pending bookings.', 'dbem');
        ?>
				<?php 
    }
    ?>
			</form>
			<?php 
    if (!empty($bookings_nav)) {
        ?>
			<div class='tablenav'>
				<?php 
        echo $bookings_nav;
        ?>
				<div class="clear"></div>
			</div>
			<?php 
    }
    ?>
		</div>	
	<?php 
}
Exemplo n.º 5
0
function em_create_events_submenu()
{
    if (function_exists('add_submenu_page')) {
        //Count pending bookings
        $bookings_num = '';
        $bookings_pending_count = 0;
        if (get_option('dbem_bookings_approval') == 1) {
            $bookings_pending_count = count(EM_Bookings::get(array('status' => 0))->bookings);
            //TODO Add flexible permissions
            if ($bookings_pending_count > 0) {
                $bookings_num = '<span class="update-plugins count-' . $bookings_pending_count . '"><span class="plugin-count">' . $bookings_pending_count . '</span></span>';
            }
        }
        //Count pending events
        $events_num = '';
        $events_pending_count = EM_Events::count(array('status' => 0, 'scope' => 'all'));
        //TODO Add flexible permissions
        if ($events_pending_count > 0) {
            $events_num = '<span class="update-plugins count-' . $events_pending_count . '"><span class="plugin-count">' . $events_pending_count . '</span></span>';
        }
        $both_pending_count = $events_pending_count + $bookings_pending_count;
        $both_num = $both_pending_count > 0 ? '<span class="update-plugins count-' . $both_pending_count . '"><span class="plugin-count">' . $both_pending_count . '</span></span>' : '';
        add_object_page(__('Events', 'dbem'), __('Events', 'dbem') . $both_num, 'edit_events', 'events-manager', 'em_admin_events_page', '../wp-content/plugins/events-manager/includes/images/calendar-16.png');
        // Add a submenu to the custom top-level menu:
        $plugin_pages = array();
        $plugin_pages[] = add_submenu_page('events-manager', __('Edit'), __('Edit') . $events_num, 'edit_events', 'events-manager', 'em_admin_events_page');
        $plugin_pages[] = add_submenu_page('events-manager', __('Add new', 'dbem'), __('Add new', 'dbem'), 'edit_events', 'events-manager-event', "em_admin_event_page");
        $plugin_pages[] = add_submenu_page('events-manager', __('Locations', 'dbem'), __('Locations', 'dbem'), 'edit_locations', 'events-manager-locations', "em_admin_locations_page");
        $plugin_pages[] = add_submenu_page('events-manager', __('Bookings', 'dbem'), __('Bookings', 'dbem') . $bookings_num, 'manage_bookings', 'events-manager-bookings', "em_bookings_page");
        $plugin_pages[] = add_submenu_page('events-manager', __('Event Categories', 'dbem'), __('Categories', 'dbem'), 'edit_categories', "events-manager-categories", 'em_admin_categories_page');
        $plugin_pages[] = add_submenu_page('events-manager', __('Events Manager Settings', 'dbem'), __('Settings', 'dbem'), 'activate_plugins', "events-manager-options", 'em_admin_options_page');
        $plugin_pages[] = add_submenu_page('events-manager', __('Getting Help for Events Manager', 'dbem'), __('Help', 'dbem'), 'activate_plugins', "events-manager-help", 'em_admin_help_page');
        $plugin_pages = apply_filters('em_create_events_submenu', $plugin_pages);
        foreach ($plugin_pages as $plugin_page) {
            add_action('admin_print_scripts-' . $plugin_page, 'em_admin_load_scripts');
            add_action('admin_head-' . $plugin_page, 'em_admin_general_script');
            add_action('admin_print_styles-' . $plugin_page, 'em_admin_load_styles');
        }
    }
}
Exemplo n.º 6
0
/**
 * bp_em_format_notifications()
 *
 * The format notification function will take DB entries for notifications and format them
 * so that they can be displayed and read on the screen.
 *
 * Notifications are "screen" notifications, that is, they appear on the notifications menu
 * in the site wide navigation bar. They are not for email notifications.
 *
 *
 * The recording is done by using bp_core_add_notification() which you can search for in this file for
 * ems of usage.
 */
function bp_em_format_notifications($action, $item_id, $secondary_item_id, $total_items)
{
    global $bp;
    switch ($action) {
        case 'pending_booking':
            //Count pending bookings
            if (get_option('dbem_bookings_approval')) {
                $EM_Bookings = EM_Bookings::get(array('status' => 0, 'owner' => get_current_user_id()));
                if (count($EM_Bookings->bookings) > 1) {
                    return apply_filters('bp_em_format_new_booking_notification', '<a href="' . $bp->loggedin_user->domain . $bp->events->slug . '/my-bookings/?event_id" title="' . __('My Bookings', 'bp-em') . '">' . __('You have a pending booking', 'dbem') . '</a>', $EM_Bookings);
                } else {
                    return apply_filters('bp_em_format_new_booking_notification', '<a href="' . $bp->loggedin_user->domain . $bp->events->slug . '/my-bookings/" title="' . __('My Bookings', 'bp-em') . '">' . sprintf(__('You have %s pending bookings', 'dbem'), $bookings_pending_count) . '</a>', $EM_Bookings);
                }
            }
            break;
        case 'confirmed_booking':
            //Count pending bookings
            $EM_Bookings = EM_Bookings::get(array('status' => 0, 'owner' => get_current_user_id()));
            if (count($EM_Bookings->bookings) > 1) {
                return apply_filters('bp_em_format_new_booking_notification', '<a href="' . $bp->loggedin_user->domain . $bp->events->slug . '/my-bookings/?event_id="' . $EM_Bookings->first()->event_id . '" title="' . __('My Bookings', 'bp-em') . '">' . __('You have a new booking', 'dbem') . '</a>', $EM_Bookings);
            } else {
                return apply_filters('bp_em_format_new_booking_notification', '<a href="' . $bp->loggedin_user->domain . $bp->events->slug . '/my-bookings/" title="' . __('My Bookings', 'bp-em') . '">' . sprintf(__('You have %s new bookings', 'dbem'), $bookings_pending_count) . '</a>', $EM_Bookings);
            }
            break;
    }
    die($action);
    do_action('bp_em_format_notifications', $action, $item_id, $secondary_item_id, $total_items);
    return false;
}
 function em_bookings_pending_count($count)
 {
     return $count + count(EM_Bookings::get(array('status' => '5'))->bookings);
 }