• Resolved carinaaek

    (@carinaaek)


    Hi there,

    maybe you can help me. Logged-in users see on the page my bookings a list of all the bookings they made, including the ones they have already cancelled. Now I have two questions:
    First, is there any way I can hide these already cancelled bookings in the list?
    And second: Next to each booked event in the list there is a link displayed so that one can cancel the booked event directly. Is it possible to rename this link? I don’t know wthat the link says in english… in german it says “freigegeben” and I would like it to be named “angemeldet”. The function behind the link – to cancel an event – should stay. I just want to change the word.

    Maybe it is only possible when having the pro version installed…?

    Thanks in advance for your help! ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello,

    The Cancelled bookings would always show on the “My Bookings” Page. currently there is no option to disable those from showing.

    As for the 2nd question, I don’t understand german and I’m not sure if google is translating it properly. I think it’s the “Approved” work, You could change the translation using any translation plugins like Loco Translate or manually changing the translation on EM Files. which is located under: events-manager\includes\langs

    In addition to @timrv’s correct answer ??
    After editing you will also need to delete the EM language files in wp-content/languages/plugins/events-manager-de_DE. Those files are loaded from the WordPress repository.

    Please note that the used terms are to be viewed from the point of view of the booking: “The booking is cancelled”. That’s why words like “Cancelled” and “Approved” and “Rejected” are used. ??
    Changing “freigegeben” to “abgemeldet” will change the meaning more to “The user has disenrolled himself” (“Der Benutzer hat sich selbst abgemeldet”).

    Changing these translations will work trough out the whole of EM, so the changes will also apply to the Admin area.

    P.S.
    Dutch EM user here, so do not reply in German. LOL

    As for the first part of you question:
    Yes, you can hide them. ?? Doing the following will even make the altered translation easier (if your blog is only in German, that is).

    You can edit the my-bookings.php template file.
    Through FTP, create a new file:
    wp-content/themes/YOUR-THEME/plugins/events-manager/templates/my-bookings.php

    I have altered the original for you, so you can simply copy & paste this in the new file. It’s a “dirty” solution, but update-proof ??

    <?php do_action('em_template_my_bookings_header'); ?>
    <?php
    	function stonehenge_rename_booking_status( $key ) {
    		$status = array(
    			'0' => 'Ausstehend',
    			'1' => 'Angemeldet',
    			'2' => 'Abgelehnt',
    			'3' => 'Abgemeldet',
    			'4' => 'Warten auf Online-Zahlung',
    			'5' => 'Noch nicht bezahlt',
    		);
    		return $status[$key];
    	}
    
    	global $wpdb, $current_user, $EM_Notices, $EM_Person;
    	if( is_user_logged_in() ):
    		$EM_Person = new EM_Person( get_current_user_id() );
    		$EM_Bookings = $EM_Person->get_bookings();
    		$bookings_count = count($EM_Bookings->bookings);
    		if($bookings_count > 0){
    			//Get events here in one query to speed things up
    			$event_ids = array();
    			foreach($EM_Bookings as $EM_Booking){
    				$event_ids[] = $EM_Booking->event_id;
    			}
    		}
    		$limit = ( !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
    		$page = ( !empty($_GET['pno']) ) ? $_GET['pno']:1;
    		$offset = ( $page > 1 ) ? ($page-1)*$limit : 0;
    		echo $EM_Notices;
    		?>
    		<div class='em-my-bookings'>
    				<?php if ( $bookings_count >= $limit ) : ?>
    				<div class='tablenav'>
    					<?php
    					if ( $bookings_count >= $limit ) {
    						$link = em_add_get_params($_SERVER['REQUEST_URI'], array('pno'=>'%PAGE%'), false); //don't html encode, so em_paginate does its thing
    						$bookings_nav = em_paginate( $link, $bookings_count, $limit, $page);
    						echo $bookings_nav;
    					}
    					?>
    					<div class="clear"></div>
    				</div>
    				<?php endif; ?>
    				<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' scope='col'><?php _e('Event', 'events-manager'); ?></th>
    							<th class='manage-column' scope='col'><?php _e('Date', 'events-manager'); ?></th>
    							<th class='manage-column' scope='col'><?php _e('Spaces', 'events-manager'); ?></th>
    							<th class='manage-column' scope='col'><?php _e('Status', 'events-manager'); ?></th>
    							<th class='manage-column' scope='col'>&nbsp;</th>
    						</tr>
    					</thead>
    					<tbody>
    						<?php
    						$rowno = 0;
    						$event_count = 0;
    						$nonce = wp_create_nonce('booking_cancel');
    						foreach ($EM_Bookings as $EM_Booking) {
    							/* @var $EM_Booking EM_Booking */
    							$EM_Event = $EM_Booking->get_event();
    							if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
    								$rowno++;
    
    // Filter out already cancelled bookings.
    if( 3 != $EM_Booking->booking_status ) {
    
    								?>
    								<tr>
    									<td><?php echo $EM_Event->output("#_EVENTLINK"); ?></td>
    									<td><?php echo $EM_Event->start()->i18n( get_option('dbem_date_format') ); ?></td>
    									<td><?php echo $EM_Booking->get_spaces() ?></td>
    									<td>
    										<?php
    											// Use the redefined Booking Status naming as defined at the top of this file.
    											echo stonehenge_rename_booking_status( $EM_Booking->booking_status );
    										?>
    									</td>
    									<td>
    										<?php
    										$cancel_link = '';
    										if( !in_array($EM_Booking->booking_status, array(2,3)) && get_option('dbem_bookings_user_cancellation') && $EM_Event->get_bookings()->has_open_time() ){
    											$cancel_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'booking_cancel', 'booking_id'=>$EM_Booking->booking_id, '_wpnonce'=>$nonce));
    											$cancel_link = '<a class="em-bookings-cancel" href="'.$cancel_url.'" onclick="if( !confirm(EM.booking_warning_cancel) ){ return false; }">Abmelden</a>';
    										}
    										echo apply_filters('em_my_bookings_booking_actions', $cancel_link, $EM_Booking);
    										?>
    									</td>
    								</tr>
    								<?php
    } // end filter of cancelled bookings.
    							}
    							do_action('em_my_bookings_booking_loop',$EM_Booking);
    							$event_count++;
    						}
    						?>
    					</tbody>
    				</table>
    				</div>
    				<?php else: ?>
    					<?php _e('You do not have any bookings.', 'events-manager'); ?>
    				<?php endif; ?>
    			<?php if( !empty($bookings_nav) && $bookings_count >= $limit ) : ?>
    			<div class='tablenav'>
    				<?php echo $bookings_nav; ?>
    				<div class="clear"></div>
    			</div>
    			<?php endif; ?>
    		</div>
    		<?php do_action('em_template_my_bookings_footer', $EM_Bookings); ?>
    <?php else: ?>
    	<p><?php echo sprintf(__('Please <a href="%s">Log In</a> to view your bookings.','events-manager'),site_url('wp-login.php?redirect_to=' . urlencode(get_permalink()), 'login'))?></p>
    <?php endif; ?>
    Thread Starter carinaaek

    (@carinaaek)

    Hi @duisterdenhaag and @timrv ,

    thanks a lot for your quick help. It took a bit of time for me to go on working on the project unfortunately. Therefore my reply also took some time. But here’s my feedback: it works ?? You made a lot of people using the tool very happy ?? So thanks a lot for your advice!!!

    The bookings are sorted nu event_id :; hoe to doet on event_date_start

    How to sort on date

    @reinoud57,
    First of all, the Forum rule is not to use others topics for different questions. For a new question, you need to create its own topic.
    Your question is not at all related to the original post.

    That being said:
    Check your settings. Events > Pages > Others Pages > My Bookings

    thx, it is that simple. I thought i needed to do something in my bookings page. This topic seemed to be close to my question. Sorry.

    This topic was already marked as “Resolved” So , you are extremely lucky I even looked here.

    “close enough” still does NOT make it your topic! DO not abuse others topics1 Simple

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Page “My Bookings”’ is closed to new replies.