WordPress.org

Ready to get started?Download WordPress

Forums

My Calendar
Bug in my_calendar_permalink_prefix() (2 posts)

  1. geoffbeaumont
    Member
    Posted 3 years ago #

    I've run into a problem with My Calendar screwing up the next and previous URLs if I'm passing other variables on the querystring and month is the first querystring variable - the current code places all the non-my calendar querystring parameters before the ? and lands you on a 404 page.

    I tracked the problem down to the my_calendar_permalink_prefix() function in my-calendar.php - it can be fixed by replacing this block of code:

    if (isset($_GET['month']) && isset($_GET['yr'])) {
    	$new_tail = split("&", $real_link);
    	foreach ($new_tail as $item) {
    		if (!strstr($item, 'month') && !strstr($item, 'yr')) {
    			$link_part .= $item.'&';
    		}
    	}
    	if (!strstr($link_part, '?')) {
    		$new_tail = split("month", $link_part);
    		$link_part = $new_tail[0].'?'.$new_tail[1];
    	}
    } else {
    $link_part = $real_link.'&';
    }

    with this:

    if (isset($_GET['month']) && isset($_GET['yr'])) {
    	$link_part = '';
    	$new_base = split('\?', $real_link);
    	if(count($new_base) > 1){
    		$new_tail = split('&', $new_base[1]);
    		foreach ($new_tail as $item) {
    			if (!strstr($item, 'month') && !strstr($item, 'yr')) {
    				$link_part .= $item.'&';
    			}
    		}
    	}
    	$link_part = $new_base[0] . ($link_part ? '?'.$link_part : '');
    } else {
    	$link_part = $real_link.'&';
    }

    Any chance of this making it into the next version?

    Cheers,
    Geoff

    http://wordpress.org/extend/plugins/my-calendar/

  2. Joe Dolson
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks, Geoff - I'll check this out.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic