• Resolved andreacianni

    (@andreacianni)


    Each time i save setting some setting in the event > setting > page
    all the event link redirect nowhere to the homepage (looks like WP, after a bit of thinking, can’t understand correctly the link so go to the homepage).

    To restore the funcionality i’ve to
    change the slug of the events on the permalink section with a new one.
    This resolve just for all the single events, not for the recurring ones when are shown by the shortconde [events-list reccurring=”1″]
    To restore this i have to edit the line 177 of the em-post.php ('rewrite' => array('slug' => 'events-recurring','with_front'=>false)) with the new slug chosen.

    Any suggestion?

    https://www.ads-software.com/plugins/events-manager/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    hi,

    this works for me; could it be a theme or another plugin causes this issues? just to narrow down the problem and help us debug the issue is it possible to try the following temporarily:

    – deactivating all other plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).
    – switching to the default theme to rule out any theme-specific problems

    Thread Starter andreacianni

    (@andreacianni)

    Strange behaviour:
    when i left the site yesterday every link works fine.
    i access today and no links work: redirect to home page, not to 404.

    so i did:

    1. switch theme to default 2016 > notingh change
    2. deactivated all the plugin except for EM > notingh change
    3. restore the line 177 of the em-post.php to default > notingh change
    4. change the permalinks in the EM setting > single event work; recurring=1 events don’t
    5. change the line 177 of the em-post.php to macht the single events permalinks slug in EM setting > Goal: single event work; recurring=1 events redirect to the first occurence.

    BUT AGAIN…

    1. Save a new setting in the EM setting (change the events page from post to page) and… ALL LINKS DON’T WORK ANYMORE

    the problem are not the theme or any plugin i suppose…
    I’m going to try the investigate the .htaccess

    Thread Starter andreacianni

    (@andreacianni)

    Strange thinks in a strange world:

    Changed the permalink setting in WP setting, restored to https://shiatsu.ilfiume.org/?p=123

    FIRST:
    Refresh the new page i done for testing (https://shiatsu.ilfiume.org/?page_id=1017) and the link was regenerated too:
    single event: https://shiatsu.ilfiume.org/?event=la-sequenza-cielo-uomo-terra >> WORKING: go to the event page
    recurrent event: https://shiatsu.ilfiume.org/?event-recurring=il-trattamento-della-schiena >> NOTWORKING: go to the homepage but in the browser (Chrome for linux) addressbar stil remain the event link!

    SECOND:
    looked to other pages with the EM shortcode and the links in the page (not saved in this session)are still with the OLD setting!!

    Thread Starter andreacianni

    (@andreacianni)

    UPDATE:
    restored theme and plugins and all the link in all the page are now updated >> single event work, aggragate recurring events [events_list recurring=1] stil not
    set the WP permalink with /%postname%/
    set the EM Permalink Slugs with appuntamenti
    edit the line 177 of the em-post.php with 'rewrite' => array('slug' => 'appuntamenti','with_front'=>false)

    and all the link, single and reccurring event work, but…
    just for now!

    I ended arrows in my bow!

    I think the problem is that you’re using direct links to the main recurring event. This is not a feature that’s supported by Events Manager.

    Although it may have worked in the past, it’s not officially supported which is why you’re having trouble getting it to work.

    Thread Starter andreacianni

    (@andreacianni)

    Sorry but…
    What’s

    you’re using direct links to the main recurring event. This is not a feature that’s supported by Events Manager.

    means?

    setting [event_list recurring=1] is not a native plugin feature?

    I find the option in the docs pages.
    The shorcode i use is [events_list category="25" scope="2016-08-01,2017-08-31" recurring="1"]<p><em>#_ATT{trimestre}</em><br /><b>#_EVENTLINK</b><br />#_CUSTOMEXCERPT</p>[/events_list]

    Can you post the complete code / formatting you’re using? Maybe I’m not following something…

    Thread Starter andreacianni

    (@andreacianni)

    Ok Starting from the really begin…

    My scenario is:
    WP multisite installation; global table activated; events & locations not belong to main site; events & location are shown in the sub-site they belong to.

    We are a Yoga Center & Shiatsu School so we have: “one day workshop”= a simple single event, “weekly class with 3 month program”=recurring events, “2 day with different time workshop”= recurring event with the second ocurrence time manual modified

    I have to display this events in a “this is our fancy program” page (here: Master Shiatsu) where using categories i display different lists using the [events_list] shortcode. In this lists i want to show only one title for the recurring events (recurring=1).

    One of this category has mixed single and recurrent event, for that i use the custom [events_list_all] shortcode i found here: List Recurring Events as one Event)

    I also defined the #_CUSTOMEXCERPT placeholder (the snippet is here)

    All the code is in the ChildTheme function.php

    So in my Master Shiatsu page i have:
    “Seminari monografici, programma 2016/17” (Here single events only)
    [events_list category="24"]<p>#_{l d F Y} <em>h. #_EVENTTIMES</em><br /><b>#_EVENTLINK</b><br />#_CUSTOMEXCERPT</p>[/events_list]

    “Programma del corso 2016/17” (mixed single and recurring events)
    [events_list_all recurring="1" category="26" scope="2016-08-01,2017-08-31" ]<p><em>#_ATT{trimestre}</em><br /><b>#_EVENTLINK</b><br />#_CUSTOMEXCERPT</p>[/events_list_all]

    “Programma degli incontri” (mixed single and recurring events)
    [events_list_all recurring="1" category="27" scope="2016-08-01,2017-08-31" ]<p><em>#_EVENTDATES</em><br /><b>#_EVENTLINK</b><br />#_CUSTOMEXCERPT</p>[/events_list_all]

    in the Shiatsu per Tutti page
    “Programma di Shiatsu per Tutti 2016/17” (recurring events only)
    [events_list category="25" scope="2016-08-01,2017-08-31" recurring="1"]<p><em>#_ATT{trimestre}</em><b>#_EVENTLINK</b>#_CUSTOMEXCERPT</p>[/events_list]

    In the HomePage:
    [events_list_all recurring="1" scope="future" limit="2"]<li>#_EVENTIMAGE{0,150}#_CATEGORYNAME<br />#_EVENTDATES<br /><b>#_EVENTLINK</b><br />#_CUSTOMEXCERPT</li>[/events_list_all]

    in the EventManagerDefaultPage just CONTENTS

    My function.php

    /* Create custom #_CUSTOMEXCERPT placeholder for Events Manager */
    function my_em_styles_placeholders( $replace, $EM_Event, $result ) {
    	global $wp_query, $wp_rewrite;
    
    	// Whether or not to strip HTML, if not be careful with the $length as you can cut off in the middle of tags
    	$strip_HTML = true;
    
    	// Max length of the excerpt (characters)
    	$length = 300;
    
    	// String to append to excerpt, if it is longer than the max length
    	$after = "…";
    
    	switch( $result ) {
    		case '#_CUSTOMEXCERPT': // name of the placeholder
    			// Get standard excerpt output
    			$replace = $EM_Event->output( "#_EVENTEXCERPT" );
    
    			// Strip all HTML
    			if ( $strip_HTML ) {
    				$replace = strip_tags( $replace );
    			}
    
    			// Only modify the excerpt if it exceeds the maximum allowed length
    			if ( strlen( $replace ) > $length ) {
    				$replace = substr( $replace, 0, $length );
    				$replace .= $after;
    			}
    
    			// Balance tags just in case
    			$replace = force_balance_tags( $replace );
    
    			break; // end the case
    	}
    
    	return $replace ; //output the placeholder
    }
    add_filter( 'em_event_output_placeholder','my_em_styles_placeholders', 1, 3 );
    
    /* Lista di eventi ricorrenti e non ricorrenti insieme
    USO: [events_list_all recurring="1"]*/
    
    function em_get_events_list_shortcode_all($atts, $format='') {
    	$atts = (array) $atts;
    	$atts['format'] = ($format != '' || empty($atts['format'])) ? $format : $atts['format'];
    	$atts['format'] = html_entity_decode($atts['format']); //shorcode doesn't accept html
    	$atts['page'] = ( !empty($atts['page']) && is_numeric($atts['page']) )? $atts['page'] : 1;
    	$atts['page'] = ( !empty($_GET['page']) && is_numeric($_GET['page']) )? $_GET['page'] : $atts['page'];        
    
            // get recurrence events
            $atts['recurring']=1;
            $evts_recurring=EM_Events::get($atts);
    
            // get non-recurrence events
            $atts['recurring']=0;
            $evts=EM_Events::get($atts);
            // filter out the events that are instances of recurring events
            $non_recurrence_evts = array_filter($evts,'is_no_recurrence');
    
            // merge recurrence and non-recurring events
            $evts_all= array_merge($non_recurrence_evts,$evts_recurring);
            // sort them by start==start date+time
            usort($evts_all,'evt_start_sort');
    
            //
    	return EM_Events::output( $evts_all, $atts );
    }
    add_shortcode ( 'events_list_all', 'em_get_events_list_shortcode_all' );
    
    function is_no_recurrence($evt) {
        return $evt->recurrence_id == null;
    }
    
    function evt_start_sort($evt1, $evt2) {
        return $evt1->start > $evt2->start;
    }
    
    function filter_condition($show_condition, $condition, $conditionals_key, $thiss) {
    
        if ($condition == "is_recurring") {
            $show_condition=$thiss->recurrence == 1;
        }
        return $show_condition;
    }
    add_filter('em_event_output_show_condition', 'filter_condition',10,4);

    i think it’s all

    Thread Starter andreacianni

    (@andreacianni)

    Ok Finally i find THE SOLUTION!!
    Now i can list my event all together single events and the first future recurrence events

    OUTPUT:

    • single-event-1 >> mydomain/events/single-event-1
    • recurring-event-1 >> mydomain/events/recurring-event-nextdate-GG-MM-AA
    • single-event-2 >> mydomain/events/single-event-2

    It’s seem to be robust enough, I “develop the solution mergin two useful snippet find here in the forum:
    recurring event link, thank to Pontus
    and events_list_all shortcode, thank to Shatting.

    to add the new shordcode i put in mychildtheme/function.php

    /*
    Recurrence and non recurrence events list together
    usage: [events_list_all recurring="1"]OPTIONAL[/events_list_all]
    */
    
    function em_get_events_list_shortcode_all($atts, $format='') {
    	$atts = (array) $atts;
    	$atts['format'] = ($format != '' || empty($atts['format'])) ? $format : $atts['format'];
    	$atts['format'] = html_entity_decode($atts['format']); //shorcode doesn't accept html
    	$atts['page'] = ( !empty($atts['page']) && is_numeric($atts['page']) )? $atts['page'] : 1;
    	$atts['page'] = ( !empty($_GET['page']) && is_numeric($_GET['page']) )? $_GET['page'] : $atts['page'];        
    
            // get recurrence events
            $atts['recurring']=1;
            $evts_recurring=EM_Events::get($atts);
    
            // get first future recurrence events
            $nextRecurrences = nextRecurrences($evts_recurring);
    
            // get non-recurrence events
            $atts['recurring']=0;
            $evts=EM_Events::get($atts);
    
            // filter out the events that are instances of recurring events
            $non_recurrence_evts = array_filter($evts,'is_no_recurrence');
    
            // merge non-recurring events and the first future recurrence events
            $evts_all= array_merge($non_recurrence_evts,$nextRecurrences);
    
            // sort them by start==start date+time
            usort($evts_all,'evt_start_sort');
    
            //
    	return EM_Events::output( $evts_all, $atts );
    }
    add_shortcode ( 'events_list_all', 'em_get_events_list_shortcode_all' );
    
    function evt_start_sort($evt1, $evt2) {
        return $evt1->start > $evt2->start;
    }
    
    function filter_condition($show_condition, $condition, $conditionals_key, $thiss) {
    
        if ($condition == "is_recurring") {
            $show_condition=$thiss->recurrence == 1;
        }
        return $show_condition;
    }
    add_filter('em_event_output_show_condition', 'filter_condition',10,4);
    
    function is_no_recurrence($evt) {
        return $evt->recurrence_id == null;
    }
    
    function nextRecurrences($evts) {
    
    	$nextRecurrences = array();
    
    	foreach ($evts as $evt) {
    		array_push($nextRecurrences,reset(nextRecurrenceOf($evt)));
    	}
    
        return $nextRecurrences;
    }
    
    function nextRecurrenceOf($evt){
    
    	return EM_Events::get(array('recurrence_id'=>$evt->event_id, 'limit'=>1, 'scope'=>'future', 'orderby'=>'event_start_date', 'order'=>'ASC'));
    }

    And to change the default behaviour of the events page i use the native template sistem, so i copy events-list.php in mychildtheme/plugins/events-manager/templates/ and modified it like:

    $args = apply_filters('em_content_events_args', $args);
    
    // get recurrence events*/
    $args['recurring']=1;
    $evts_recurring=EM_Events::get($args);
    
    // get first future recurrence events
    $nextRecurrences = nextRecurrences($evts_recurring);
    
    // get non-recurrence events
    $args['recurring']=0;
    $evts=EM_Events::get($args);
    
    // filter out the events that are instances of recurring events
    $non_recurrence_evts = array_filter($evts,'is_no_recurrence');
    
    // merge nextRecurrences and non-recurring events
    $evts_all= array_merge($non_recurrence_evts,$nextRecurrences);
    
    // sort them by start==start date+time
    usort($evts_all,'evt_start_sort');
    
    if( get_option('dbem_css_evlist') ) echo "<div class='css-events-list'>";
    
    echo EM_Events::output( $evts_all );
    
    if( get_option('dbem_css_evlist') ) echo "</div>";

    You can see the result here, here, and here!

    Great solution Andrea, you saved me a lot of time with this code.

    I’m having problem that I couldn’t save the setting of Event Manager Plugin. The page prompted <404 Not Found> error. I tried the solution to update < Permalink Settings> to Plain. Unfortunately it didn’t work and i saw the new error below upon Even Manager Setting saving:

    Forbidden
    You don’t have permission to access /wp/wp-admin/edit.php on this server.
    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

    Please help!!!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Each time i save setting all the event link are broken’ is closed to new replies.