domina83
Forum Replies Created
-
Hi Marcus,
I did as you said. And with the fresh WP +BP installation everything worked fine, but as soon as I installed my theme I had the same problem.
Now I know what it is. Because the theme has its own layout manager, it is not calling the template_redirect action, and the EM globals are not being populated.
I changed the following to make it work with the theme:
add_action('template_redirect', 'em_load_event', 1); if(is_admin()){ add_action('init', 'em_load_event', 2); }
to
add_action('init', 'em_load_event', 1); if(is_admin()){ add_action('init', 'em_load_event', 2); }
Do you have any remarks if this is safe? Thanks!!
Hi Marcus,
I investigated the problem and I think the reason might be the gloabal $EM_Person being NULL.
Here is what I did step by step.
In the em-actions.php code related to the bookings the user is registered, the action is ‘booking_add’, double bookings are not allowed, but the user has no previous bookings so it correctly gets to that ‘if’ statement. Straight after there is another if satement:
if ($EM_Booking->get_post() )
I followed to the em-booking.php then the get_post() function calls $this->get_person().
And this is where I found the issue. It wrongly gets to the last ‘else’ statement. The reson is that the booking object holds just the event_id, so:
$this->person_id is null,
global $EM_Person is null,
$this->booking_id is null, so it gets to the last else:else { $this->person = new EM_Person(0); }
I fixed that temporaly by adding another elseif:
else if( null==$this->person_id && null==$EM_Person ) { $this->person = new EM_Person(get_current_user_id()); }
but I am not sue if this is the best solution, and if this won’t break other cases.
Do you need more details on how to recreate this issue?
– Dominika
Sorry, forgot to mention your plugin version: 5.0.51