Show events by date range using [eab_single]

I am trying to do 2 things that I cannot seem to figure out how to do. first, I am trying to list all upcoming events for the next week only, but not use the [eab_calendar] shortcode. I would rather have the events displayed on the page like they would be displayed using the [eab_single] shortcode. I have also tried to use the slug argument with [eab_single] to list only certain types of events, but I am unable to make that work either. I know I can list each event using the id argument, but would rather have this happen automatically instead of needing to manually update the page with the current event id's.

the second thing I am trying to do is to display events to visitors that do not have an account. These visitors should be able to see the details of the event but not be shown the RSVP buttons so they will not be asked to login to complete the RSVP process.

  • Vinod Dalvi

    Hi @Phil,

    I hope you are well today and thank you for your questions.

    I am trying to list all upcoming events for the next week only, but not use the [eab_calendar] shortcode. I have also tried to use the slug argument with [eab_single] to list only certain types of events

    The shortcode [eab_single] display only a single event by its id. To display list of all upcoming events for the next week you should use the shortcode [eab_archive] and its following parameters.

    date - (date) Starting date - default to now
    relative_date - (strtotime-compatible string) A date relative to now or to date argument
    lookahead - (boolean) Don't use default monthly page - use weeks count instead
    weeks - (integer) Look ahead this many weeks

    the second thing I am trying to do is to display events to visitors that do not have an account. These visitors should be able to see the details of the event but not be shown the RSVP buttons so they will not be asked to login to complete the RSVP process.

    You can achieve this by adding the following code in the functions.php file of your theme.

    function custom_ea_rsvps( $content, $event ){
    	if( ! is_user_logged_in()){
    		return '';
    	}
    	return $content;
    }
    add_filter('eab-rsvps-rsvp_form', 'custom_ea_rsvps',10, 2 );

    Kind Regards,
    Vinod Dalvi

  • Vinod Dalvi

    Hi @Phil,

    Thank you for your reply.

    Yes it's possible to display text in place of RSVP buttons.

    Do you want to display this text only for non logged in users?

    If so then you can achieve this using the following code in the functions.php file of your theme.

    function custom_ea_rsvps( $content, $event ){
    	if( ! is_user_logged_in()){
    		return 'Add some text here for non logged in users';
    	}
    	return $content;
    }
    add_filter('eab-rsvps-rsvp_form', 'custom_ea_rsvps',10, 2 );

    Regards,
    Vinod Dalvi

  • Phil

    Hello @Vinod, you are a rock star! now for the hard part....

    We will be putting protected content into the event contents using the membership integration. I would like to have the short-codes be put into the event automatically so I don't have to teach non tech folks about using them. I assume this would be some modification to the plugin files, and I am willing to do this to get the functionality we need. For Example, when a user creates an event and selects a category, the proper short-code will appear in the body of the event.

    [level-Swim-member] [/level-Swim-member] --if swim category is selected
    [level-Bike-member] [/level-Bike-member] --if bike category is selected
    [level-Run-member] [/level-Run-member] --if run category is selected

    An easier solution which would be acceptable would be to just populate all short-codes and the user would need to put the protected content between the proper short-codes depending on the type of protected content.

    Thank you for all of your help with this.

    Phil

  • Rahul Verma

    Hello Phil,

    Hope you're doing well.

    Might be display shortcode directly in event body can disturb your already written content.

    How is it if we display it below the categories section? Please check attached screenshot.

    If that works for you, Please put following snippet of javascript code in wp-content/plugins/events-and-bookings/js/eab-admin.js file.

    jQuery("input[id^='in-eab_events_category-'").change(function(){
    
    		if(jQuery(this).is(":checked")==true)
    		{
    				jQuery("#taxonomy-eab_events_category").append("<div class='shortcode"+jQuery(this).attr("id")+"'>[level-"+jQuery(this).parent().text()+"-member] [/level-"+jQuery(this).parent().text()+"-member]</div>");
    		}
    		else
    		{
    				jQuery("#taxonomy-eab_events_category .shortcode"+jQuery(this).attr("id")+"").remove();
    
    		}
    
    		});	
    
    	});

    I hope that helps. Please feel free to ask if you have more questions on the same.

    Best Regards
    Sandeep Kumar

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.