WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
All bookings as Non-Registered User - but users registered via buddypress (12 posts)

  1. domina83
    Member
    Posted 2 years ago #

    Hi, I just started using your plugin and need your help.
    My WordPress setup is using BuddyPress 1.5 and s2Member plugin, but users register using BuddyPress registration form. I have only registered users able to view the content.

    I have created an event (as admin) and it is displayed as the post. When user clicks 'Send your booking', the booking is made as 'Non-Registered User'.

    The user level is subscriber, which corresponds to s2Member user level#1.

    The post request data:

    em_tickets[1][spaces]:1
    booking_comment:
    action:booking_add
    event_id:4
    _wpnonce:c13d634bbe

    Would this be the reason that the user is logged in as a buddypress user? Should I edit some file and add manually add person_id hidden input? Would that work?

    Thank you for any help and please let me know if you need more details!

    - Dominika

    http://wordpress.org/extend/plugins/events-manager/

  2. domina83
    Member
    Posted 2 years ago #

    Sorry, forgot to mention your plugin version: 5.0.51

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    Sounds to me like you could have a user setup issue. Does it work if you disable s2member? It does work with BP users, they are normal wp users as well.

  4. domina83
    Member
    Posted 2 years ago #

    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

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    This is done on purpose. Not sure what you're trying to athere needs to be an else here, because this function needs to return an EM_Person object, otherwise it'll break other parts of the site that expect an EM_Person.

    Did you try using BP and EM without any other plugins on the default bp theme?

  6. domina83
    Member
    Posted 2 years ago #

    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!!

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    yup, that'd work but i'd advise you copy both snippets above to your functions.php file and in the first snippet replace add_action with remove_action. Otherwise your action ordering will be rewritten each update.

  8. rickleijtencom
    Member
    Posted 2 years ago #

    I had the same problem, made my own theme and events manager stopped working. The following code u wrote worked for me:

    add_action('init', 'em_load_event', 1);
    if(is_admin()){ add_action('init', 'em_load_event', 2); }

    That stuff worked good :)

    But now he gives a non succes message.. it returns the following:
    You are currently attending this event. Manage my bookings

    I think i can understand why it returns it, cuz the page just reloads and gives u a message u can manage your bookings. Any idea where to manage the returns?

  9. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    yes, the $EM_Notices var/object, which is global.

  10. ntwrkguru
    Member
    Posted 2 years ago #

    @Marcus. This resolved my issue, but like @rickleijtencom said, there is a problem with the return. Where can I find the $EM_Notices object?

  11. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    just write

    global $EM_Notices;

  12. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    if you mean the file/class itself, see the classes folder

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic