Events, Buddypress, membership2

I am trying to build a buddypress site, I want to have a list of events on the home page (like the widget) - but deny access to the actual event info and rsvp until they are logged in, how can I do that?

  • Luís

    Hi @reikob,

    I hope had been good today!

    I think you have 2 solutions:

    1) You can use Membership 2 Pro, with a Default membership to protect the "Events" post type, but you will need to create the events lists widget manually, like a custom menu.

    If you protect a "Events" post type, the "Upcoming events" don't will show any event.

    2) Add some custom code to the single event template to protect the entire content, something like:

    <?php
    if ( is_user_logged_in() ) {
    // the single event template content.
    } else {
        <a href="http://domain.com/login">Sign In</a>
    };
    ?>

    I hope this information has been helpful. If I can help you in this or other questions, please let me know!

    Cheers, Luís

  • Luís

    Hi @reikob,

    I hope had been good today!

    Firstly, sorry for my late reply and all the problems it may have caused.

    I tested that in my install, and I think you need to customize your single-incsub_event.php.

    1) Copy the /wp-content/plugins/events-and-bookings/default-templates/default/single-incsub_event.php to the root of your theme.

    2) Made the changes in this file.

    3) Probably you will need to make some changes in order to this file follow the structure of the theme single.php.

    I hope this information has been helpful. If I can help you in this or other questions, please let me know!

    Cheers, Luís

  • reikob

    okay, I copied the file and put it in 2015 theme folder and added the code - I really am not sure what I am doing, but put it just below get header:
    `<?php
    global $blog_id, $wp_query, $booking, $post, $current_user;
    $event = new Eab_EventModel($post);

    get_header( );
    ?>
    <?php
    if ( is_user_logged_in() ) {
    <div id="primary">
    <div id="content" role="main">
    <div class="event <?php echo Eab_Template::get_status_class($post); ?>" id="wpmudevevents-wrapper">
    <div id="wpmudevents-single">

    <?php
    the_post();

    $start_day = date_i18n('m', strtotime(get_post_meta($post->ID, 'incsub_event_start', true)));
    ?>

    <div class="wpmudevevents-header">
    <h2><?php echo $event->get_title(); ?></h2>
    <div class="eab-needtomove"><div id="event-bread-crumbs" ><?php echo Eab_Template::get_breadcrumbs($event); ?></div></div>
    <?php
    echo Eab_Template::get_rsvp_form($post);
    echo Eab_Template::get_inline_rsvps($post);
    ?>
    </div>

    <hr />
    <?php

    if ($event->is_premium() && $event->user_is_coming() && !$event->user_paid()) { ?>
    <div id="wpmudevevents-payment">
    <?php _e('You haven\'t paid for this event', Eab_EventsHub::TEXT_DOMAIN); ?>
    <?php echo Eab_Template::get_payment_forms($post); ?>
    </div>
    <?php } ?>

    <?php echo Eab_Template::get_error_notice(); ?>

    <div class="wpmudevevents-content">
    <div id="wpmudevevents-contentheader">
    <h3><?php _e('About this event:', Eab_EventsHub::TEXT_DOMAIN); ?></h3>

    <div id="wpmudevevents-user"><?php _e('Created by ', Eab_EventsHub::TEXT_DOMAIN); ?><?php the_author_link();?></div>
    </div>

    <hr />
    <div class="wpmudevevents-contentmeta">
    <?php echo Eab_Template::get_event_details($post); //event_details(); ?>
    </div>
    <div id="wpmudevevents-contentbody">
    <?php
    add_filter('agm_google_maps-options', 'eab_autoshow_map_off', 99);
    the_content();
    remove_filter('agm_google_maps-options', 'eab_autoshow_map_off');
    ?>
    <?php if ($event->has_venue_map()) { ?>
    <div class="wpmudevevents-map"><?php echo $event->get_venue_location(Eab_EventModel::VENUE_AS_MAP); ?></div>
    <?php } ?>
    </div>
    <?php comments_template( '', true ); ?>
    </div>
    </div>
    </div>
    </div>
    </div>}
    } else {
    Sign In
    };
    ?>
    <?php get_footer('event'); ?>

    and got this: Parse error: syntax error, unexpected '<' in /home/trbdev/public_html/ub2/wp-content/themes/twentyfifteen/single-incsub_event.php on line 10

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.