Support

Home Forums Events Calendar Add-on Calendar Category Colors 2

Calendar Category Colors 2

Posted: August 6, 2013 at 8:40 pm

Viewing 22 reply threads


Greg Davis

August 6, 2013 at 8:40 pm

Did this problem start happening again? Seems like the CSS classes based on category are not being generated?


Josh

  • Support Staff

August 6, 2013 at 9:15 pm

Hi Greg,

I don’t believe so. My test calendar is outputting the CSS classes for categories. It’s running a stock version of the current calendar add-on.

http://is.gd/W6GaAT

There are two Calendar Settings that will affect this, so you might try checking them in Event Espresso>Calendar Settings. The first one is “Enable CSS for Categories”. This one needs to be set to Yes.

The second one is “Disable Categories”. This one needs to be set to No.


Greg Davis

August 7, 2013 at 7:19 am

The 2 calendar settings are set correctly as we have been using this feature before. In our calendar do you see any CSS categories> https://kennett-design.com/calendar/


Josh

  • Support Staff

August 7, 2013 at 11:01 am

I do not. Can you let us know which version of the calendar add-on you are using? Also, what is the shortcode on the calendar page? For example are there any category parameters added to the shortcode?

One thing that may help in this case is you could try changing the two settings that configure the category options, then save, then change them back and save to be sure the settings are saved correctly.


Greg Davis

August 7, 2013 at 6:40 pm

We do have Version 2.0.6.1 of the calendar add-on installed. The shortcode on the page is [ESPRESSO_CALENDAR]

I also changed the settings saved, changed them back and resaved but no luck with that either.


Josh

  • Support Staff

August 7, 2013 at 7:41 pm

It might be limiting out on the # of queries (pulling from the category table for each event can make a difference) Right now it’s showing 1177 queries. If you try changing the shortcode to [ESPRESSO_CALENDAR show_expired=”false”] it will reduce the # of queries and you might get the category classes back.


Greg Davis

August 7, 2013 at 7:49 pm

Interesting thought. I tried that, but still not fixing it. Any other ideas?


Josh

  • Support Staff

August 7, 2013 at 8:00 pm

You could try downloading and installing a fresh copy of the Event Espresso Calendar add-on. That’s the code i’m running on my test sites and the category class names are working there.


Josh

  • Support Staff

August 7, 2013 at 8:15 pm

Along with that, you could try the very latest beta of the calendar. The one in the pre-release had an open ticket that needed to be fixed, and has since been resolved.

Here’s a download link if you’d like to try the latest beta:

Calendar 2.1 beta


Greg Davis

August 8, 2013 at 5:32 am

Okay, I will give that a try later today. In the meantime I should have mentioned I am using WP 3.6. Not sure which version your test was using.


Josh

  • Support Staff

August 8, 2013 at 7:30 am

Hi Greg,

My test sites all run WP 3.6.


Greg Davis

August 8, 2013 at 9:40 pm

Well… I tried reinstalling the calendar add-on first the 2.0.6.1 version (no change) then I tried the BETA version. I deactivated the 2.0.6.1 version first but still did not get the category class colors (via the custom CSS I have been using before), so I removed the BETA version and reactivated the regular version.

BUT NOW THE CALENDAR DOESN’T DISPLAY AT ALL!!! I tried removing the calendar plugin altogether and reinstalled again, but still no luck. It seems having installed the BETA left a setting in the database somewhere and now the regular version doesn’t work?

Please help as my client’s business depends o having the calendar working!


Greg Davis

August 9, 2013 at 4:35 am

I restored my client’s database from a backup which was taken before I installed the BETA calendar add-on and that did bring back the calendar so the emergency situation is avoided.

However, I really would like to get to the bottom of the missing category CSS class colors still.


Josh

  • Support Staff

August 9, 2013 at 5:23 am

Hi Greg,

I checked and the calendar is displaying from my end. I can imagine that if you go from the new calendar to the old calendar the reset settings box would need to be checked in order to restore the old calendar’s default settings in the database.

With the category colors not working: Has there been any new events or event categories added between now and the time the colors stopped working? You could troubleshoot this by creating a new page and use the event_category_id parameter in the [ESPRESSO_CALENDAR] shortcode to show events from one category. That might help narrow things down if there’s an issue with one of the categories.


Greg Davis

August 10, 2013 at 2:55 pm

Okay – I created 2 new pages 1 for each of the categories I’m trying to target.

The first one is: https://kennett-design.com/2-hour-events/
and the second one is: https://kennett-design.com/3-hour-events/

As you can see the CSS styling is working for each individually, but not with the regular calendar: https://kennett-design.com/calendar/

Any clues?


Josh

  • Support Staff

August 12, 2013 at 8:25 am

It still seems like it’s hitting a query limit. What happens to the colors on the main calendar page if the event times, tooltips, and registration limit features are disabled?


Greg Davis

August 12, 2013 at 10:37 am

Okay – I played with those 3 calendar options and it seems like the “Display Attendee Limits” is the culprit. When I have that turned on, I loose the CSS category color styling, when I turn it off it comes back. Thanks for your help to isolate that.

Now… is there anyway to have both (setting turned on and not loose the category colors)? Does more memory need to be allocated in the WP or server settings?


Sidney Harrell

August 12, 2013 at 3:35 pm

I can squeeze a little more efficiency out of it, if you would like to try it. In espresso-calendar.php starting at line 343:

$orig_attendee_limit = get_number_of_attendees_reg_limit($event->id, $type = 'num_attendees_slash_reg_limit');
			$parse_limits = explode( '/', $orig_attendee_limit, 2 );
			$num_completed = $parse_limits[0];
			$reg_limit = $parse_limits[1];

you can change it to:

$num_completed = 0;
				$a_sql = "SELECT SUM(quantity) quantity FROM " . EVENTS_ATTENDEE_TABLE . " WHERE event_id=%d AND (payment_status='Completed' OR payment_status='Pending' OR payment_status='Refund') ";
				$wpdb->get_results( $wpdb->prepare( $a_sql, $event_id ), ARRAY_A);
				if ($wpdb->num_rows > 0 && $wpdb->last_result[0]->quantity != NULL) {
					$num_completed = $wpdb->last_result[0]->quantity;
				}
$reg_limit = $event->reg_limit


Greg Davis

August 13, 2013 at 8:09 pm

Sidney – I replaced the 4 lines you listed to the 7 you provided, but when I did I got an internal server error and white screen of death. I put it back to the way it was to get rid of that.

Is there something not correct in that code or is there another suggestion?


Greg Davis

August 13, 2013 at 8:18 pm

I think I found the problem. There was a missing “;” on the last line of your code (line 7). I added that and it seems to now be working and giving me back the category colors! ๐Ÿ™‚

HOWEVER – the attendee number that appears in the tooltip hover pop-up is coming up as always zero, which I confirmed is not correct. ๐Ÿ™

Is there a bug in the code you provided regarding the quantity?


Josh

  • Support Staff

August 13, 2013 at 10:18 pm

It looks like $event_id needs to be $event->id. Here’s the block with the correction and w/o the goofy line numbers:

$num_completed = 0;
$a_sql = "SELECT SUM(quantity) quantity FROM " . EVENTS_ATTENDEE_TABLE . " WHERE event_id=%d AND (payment_status='Completed' OR payment_status='Pending' OR payment_status='Refund') ";
$wpdb->get_results( $wpdb->prepare( $a_sql, $event->id ), ARRAY_A);
if ($wpdb->num_rows > 0 && $wpdb->last_result[0]->quantity != NULL) {
	$num_completed = $wpdb->last_result[0]->quantity;
}
$reg_limit = $event->reg_limit;


Greg Davis

August 14, 2013 at 9:13 am

Excellent – thanks Josh! This finally has done the trick! I have both the correct category colors (based on CSS styling) and the correct attendee totals in the hover pop-up.

Will this be something that makes it way into a future release of the calendar add-on or will I need to keep replacing the standard code with this?


Josh

  • Support Staff

August 14, 2013 at 10:03 am

I’m not sure. Someone on the dev team will review the code that Sidney came up with and if all is well it can be incorporated into a future release.

Viewing 22 reply threads

The support post ‘Calendar Category Colors 2’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso