Support

Home Forums Event Espresso Premium Attendee limit bug

Attendee limit bug

Posted: January 6, 2014 at 8:28 am

Viewing 17 reply threads


Mark Williamson

January 6, 2014 at 8:28 am

Hi

We’ve discovered that there appears to be an issue with event limits. If the event capacity is set to 50, the system will accept bookings up to 49 but any more won’t register in the system but will allow people to book from the front end. Is this something you’ve experienced before?


Josh

  • Support Staff

January 6, 2014 at 11:04 am

Hi Mark,

I haven’t. Which version of Event Espresso is installed, and can you post a link to the event in question so we can take a look?


Mark Williamson

January 7, 2014 at 2:14 am

Hi Josh

It’s version 3.1.36.1.P, link to the event here: http://events.psnc.org.uk/event-registration/?ee=6

Many thanks


Dean

January 8, 2014 at 6:23 am

Hi,

Did the attendees get registered from the front end or were they added in the admin area (manually or via import)?


Mark Williamson

January 8, 2014 at 6:27 am

Hi Dean

From the front end

Mark


Dean

January 8, 2014 at 6:37 am

Thank you and is the event you linked earlier in the thread currently full?


Mark Williamson

January 8, 2014 at 7:14 am

No, it is maximum capacity -1

When any event is maximum capacity -1, it will still allow you to register on the front end but it won’t add any more registrants on the back end


Mark Williamson

January 8, 2014 at 7:15 am

It seems to get stuck at “maximum -1”. eg if capacity was 30, it will register up to 29 and then stop collecting data although the front end still allows registrations.


Josh

  • Support Staff

January 8, 2014 at 11:33 am

Hi Mark,

Where are you setting the maximum capacity to -1?


Mark Williamson

January 8, 2014 at 1:39 pm

Sorry, to be clear, I’m not setting the maximum capacity to -1, I was merely trying to represent that the system fails one delegate below maximum capacity so if the maximum is 30, it fails at 29. If capacity is 200, it fails at 299. If maximum capacity is ‘x’, then the system fails at x-1


Mark Williamson

January 8, 2014 at 1:40 pm

[amendment]
“If capacity is 200, it fails at 299” should be “If capacity is 200, it fails at 199”


Josh

  • Support Staff

January 9, 2014 at 9:26 am

Hi Mark,

I checked the source code on the page that you linked to and it looks like there are quite a few of the Event Espresso templates that have been moved to /wp-content/uploads/espresso/templates. That may be causing the issue. Have you tried this with the stock Event Espresso templates?


Mark Williamson

January 10, 2014 at 2:28 am

I had coped the EE templates over to the wp-uploads folder but had made no changes except adding

<?php echo do_shortcode( '[ESPRESSO_CART_LINK anchor="Register" direct_to_cart=1 moving_to_cart="Redirecting to basket..."]'); ?>

At the bottom of the page as the client wanted to move the ‘add to cart’ button to the bottom.

I have just tried using the stock templates with no ‘add to basket’ button (selecting “yes” for “display registration form”) and it all appears to work ok.

However, if I select “no” for display registration form and add the shortcode for add to cart as described here https://eventespresso.com/wiki/multiple-events-registration-use-add-to-cart-link-instead-of-default-registration-form/ the bug reappears. So we’ve narrowed down the issue but any ideas how to fix it?

Cheers


Josh

  • Support Staff

January 10, 2014 at 11:55 am

Hi Mark,

When you place an add to cart shortcode in a do_shortcode in a template it needs to have the event ID in order to work. When the add to cart shortcode is in the event’s description, Event Espresso knows it’s for that event, but it doesn’t if it’s within the template.

Can you try changing your template code to:

<?php echo do_shortcode('[ESPRESSO_CART_LINK event_id="'.$event_id.'" anchor="Add to Cart"]'); ?>

So that it includes the event’s ID? This might help.


Mark Williamson

January 11, 2014 at 12:17 am

Sorry Josh, no joy


Josh

  • Support Staff

January 13, 2014 at 10:06 am

Mark,

Can you check the PHP error log for any errors when you try registering for that last spot?


Mark Williamson

January 14, 2014 at 2:28 am

Hi Josh

No errors showing I’m afraid. This same bug seems to happen on your test install here as well https://eventespresso.com/testdrive/wp-admin/admin.php?page=events&action=edit&event_id=22288

Mark


Josh

  • Support Staff

January 14, 2014 at 8:46 am

Hi Mark,

We’ve worked out a solution that appears to be working. It requires changes to 2 files:
1: includes/functions/cart.php, starting at line 195 should be changed to:

$attendee_quantity = 0;
				
				if ( isset( $_POST['price_id'][$event_id] )) {
					$price_id = $_POST['price_id'][$event_id];
				} else {
					return FALSE;
				}

				if (is_array($price_id)) {
					foreach ($price_id as $_price_id => $val) {
						//assign the event type and the quantity
						$attendee_quantity += $updated_events_in_session[$event_id]['price_id'][$_price_id]['attendee_quantity'] = esc_sql($val);
						$updated_events_in_session[$event_id]['price_id'][$_price_id]['price_type'] = $events_in_session[$event_id]['price_id'][$_price_id]['price_type'];

					}
				} else if ( $price_id !== FALSE ) {

Note that line 195 and 206 are changed, and what was line 209 is deleted.
2: includes/process-registration/add_attendees_to_db.php, starting at line 713:

$return_data = event_espresso_add_attendees_to_db( $event_id, $session_vars, TRUE );
								if (!empty($return_data['registration_id'])) $session_vars['data']['attendee_quantity']--;

That second line is a new line of code. The first line is unchanged, it’s there as a reference as to where to put the second line.

We’ll be testing this to try to get a hotfix release out to address the issue (3.1.36.3), so any feedback you can provide from testing these changes on your end would be helpful.

If you have trouble applying the changes, let us know by filling out the form here (be sure to include ftp credentials), and we can apply them for you.

Viewing 17 reply threads

The support post ‘Attendee limit bug’ 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