Jump to content


- - - - -

[IP.Calendar 3.2.2] Upcoming birthdays block can lead to a calendar not displaying birthdays


There is a minor bug in IP.Calendar 3.2.2 if your primary calendar does not display birthdays.  To experience this bug, you must have a primary calendar that does not display birthdays, a secondary calendar that does display birthdays, and the upcoming birthdays hook displaying on the board index.

To resolve this bug, you can edit an IP.Calendar PHP source file to patch it.

Open admin/applications_addon/ips/calendar/sources/hooks.php

Find

   	 if( $count > count($users) )
		{
			$classToLoad	= IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
			$functions		= new $classToLoad( $this->registry );

			$calendar   	 = $functions->getCalendar();

	   	 $data			= array(
									'id'	=> $calendar['cal_id'],
									'title'	=> $calendar['cal_title_seo'],
									'year'	=> $year,
									'month'	=> $month,
									'day'	=> $day,
									);

		}

Change this to

   	 if( $count > count($users) )
		{
			$classToLoad	= IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
			$functions		= new $classToLoad( $this->registry );

			$calendars		= $functions->getCalendars();
			
			foreach( $calendars as $calendar )
			{
				/* We need to grab first calendar that allows birthdays */
				if( !$calendar['cal_bday_limit'] )
				{
					continue;
				}

				$data			= array(
										'id'	=> $calendar['cal_id'],
										'title'	=> $calendar['cal_title_seo'],
										'year'	=> $year,
										'month'	=> $month,
										'day'	=> $day,
										);

				break;
			}
		}
		
		if( !count($data) )
		{
			return '';
		}

Save the file and reupload it.  The link will now point to the first calendar found that displays birthdays, or the hook will not display if you do not display birthdays on your calendar.


0 Comments


Do you have a tip, alternative approach, or extra information you want to share with the IPS community regarding this article? Did you spot an issue with this article, or is it missing useful information? Feel free to contribute by adding a comment!
Comments are not for questions or support. Such comments will be deleted.

Developer Docs · Error Codes