Search

Integrating BuddyPress and Event Espresso for a Meetup Website

Listen to this article

Learndash-BuddyPress-Integration-groupsLast week a post was published in which details on getting started with a groups based events website like meetup.com were covered. The main idea in the post was to understand the system and the essential resources that will be required to build it.

Today I am going to probe the solution further to understand how to implement it using BuddyPress and Event Espresso. While BuddyPress is my choice of plugin to implement the groups feature on the website, my choice of events plugin is Event Espresso.

Additionally, we’ll require the Events Calendar add-on for Event Espresso to display all upcoming events of a particular group in a logical format facilitating an easy option for end-users to search and navigate through events.

Why Events Espresso?

Some might know of this, some might not. Here’s the deal though!

Event Espresso has not been integrated to work with BuddyPress just yet. Now you might wonder why am I encouraging the use of Event Espresso if there isn’t any integration available. In fact, some might also prefer the use of the Events Manager plugin as it has been integrated with BuddyPress and they would be right in doing so.

I have one and only one reason to choose Event Espresso – Features.

Events Manager is a great plugin no doubt. However, if you have a particular payment gateway or third party plugin in mind and you need to choose Event Espresso then here’s how you’ll have to go integrating BuddyPress and Event Espresso.

Of course, if the features provided by Events Manager suffice your requirements and you want to go ahead with it then linking Events with Groups on the website is relatively simple. I’ll show you how to do that too! But before that let’s get started with implementing the website using BuddyPress and EventEspresso

How to Create Groups with BuddyPress?

Primarily the website in question is a social networking platform for users to meet and stay connected with like-minded people through groups. For example, if I am interested in photography I would search for a photography related group based at a convenient location. Here, location is important as unlike an online group, offline meetups would be the main idea of joining a group. So if you’re based in New York and you join a group in Texas it wouldn’t make sense as you wouldn’t be able to attend the meetups on a regular basis.

Let’s take a tour of BuddyPress to understand how to use it in a meetup based website.

Step 1: Install and activate BuddyPress on your website.

Step 2: Now go to Settings –> BuddyPress and tick the checkbox against

  • User Groups – To enable the option to create groups on your website (Required)
  • Private Messaging – If you want group members to be able to send private messages to each other. (Optional)
  • Friend Connections – If you want group members to be able to send friend requests to each other. (Optional)

buddypress-and-event-espresso-1

Step 3: On installation and activation of BuddyPress various pages such as Activity, Groups, Members are created. These pages can be added to the main navigation menu by going through the following path.

Appearance –> Menus

buddypress-and-event-espresso-2

Step 4: The next step would be group creation. As a registered user, you can create groups from the front-end with an option provided on the groups page.

buddypress-and-event-espresso-3

During group creation, you will have the option to set privacy options for groups. Based on these privacy options a group can be public, private or hidden. Also, members who are allowed to invite others to the group can be restricted.

On reaching the ‘Invites’ tab, you can send invites to people on your friends list.

buddypress-and-event-espresso-4

What if I want to restrict group creation for users?

If you want to restrict the group creation feature for users then uncheck the ‘Enable group creation for all users’ field on the following path – Settings –> BuddyPress –> Settings tab.

buddypress-and-event-espresso-4

Step 5: Once you have created a group the following options will be available on a group page.

  • Section to view group members.
  • An option to send invites to others. (This option will not be available for all users if the group was created with restrictions.)
  • An option to edit group details is available in the ‘Manage’ tab for the group admin. All users can comment and favorite activities on the group. Also, the owner of a particular activity can delete an activity if required.

buddypress-and-event-espresso-6

  • Users other than the admin can join a group if restrictions have not been imposed on the group. However, if restrictions have been enforced then the ‘Join Group‘ button will not be shown to all users.

The 5 steps above involve the main actions pertaining to groups on the meetup website. The groups created on the front end are saved in the groups table at the backend. This table can be accessed from the website backend in the ‘Groups’ tab. Similarly, the activities can also be accessed from the ‘Activities’ tab.

Lastly, and most importantly, the best part about using BuddyPress for the groups feature is that it is available for free download on wordpress.org and provides all the basic features of a social networking website. 

How to Integrate BuddyPress with Event Espresso?

With groups, the first part of the website has been completed. The next step would be to create events and link these events with groups.

Here we are looking to provide users with an option to select the groups for which an event will be available. When a particular group is selected on the events page, members of that group will be able to register for the event and attend it. The registration of that event will be restricted to other users who are not part of the selected group.

To be able to do so the following steps will have to be executed.

Step 1: Create a Metabox on Event Page.

On the events page, a meta box will have to be created. This meta box will display a list of all groups on the website. An event author can select one or more groups to which the event will be made available.

The meta box will be added on the ‘admin_init’ hook.

add_action( 'admin_init', 'wdm_add_event_metabox' );
function wdm_add_event_metabox() {
     add_meta_box(
     'event_metabox',
     'Select groups',
     'group_event_option',
     'espresso_events',
     'side',
     'core'
    );
}

function group_event_option($postevent) {
     //get list of BuddyPress groups 
     global $wpdb;
     echo $tbl = $wpdb->prefix.'bp_groups';
     $groups = $wpdb->get_results("SELECT id, name from $tbl"); //can     add condition to display only public or private groups
     //Display these groups
}

[space]

Step 2: Save Event Meta

The event author’s selection will then have to be saved. This will be done using the ‘save_post‘ hook provided by Event Espresso.

add_action('save_post', 'groups_save_metabox');
function groups_save_metabox($post_event_id) {
   //save event meta
}

Step 3: Restrict Registration Page Access to Non-Members

Lastly, you will have to restrict the access to the registration page to users that do not belong to the group for which an event is available. This can be done using the ‘AHEE__registration_page_attendee_information__start‘ Event Espresso hook.

add_action('AHEE__registration_page_attendee_information__start','wdm_hide_event_form');
function wdm_hide_event_form() {
   if(logged in user is not member of group) {
   echo 'This event is private';
?>
   <script>
    jQuery(document).ready(function(){
    jQuery('#spco-attendee_information-dv').remove();
    })
   </script>
   <?php
   }
  }

[space]
With that step, you’ll complete the integration process of BuddyPress and Event Espresso. Now the only step that would remain is to display a calendar of all events on the website. This can be done using the Events Calendar add-on for Event EspressoThe plugin allows you to display all websites events in an easy to read, graphical calendar.

What if I want to Use the Events Manager Plugin?

Well, if you want to use the Events Manager plugin then linking events with groups is easy as Events Manager has been integrated with BuddyPress.

The group creation part of the setup will remain the same with Events Manager too. Once the groups have been created a group can then be linked with an event on the events page using the ‘Group Ownership‘ meta box.

buddypress-and-event-espresso-7

Once the event has been saved it will be displayed in the ‘Events‘ tab on the Groups page.

buddypress-and-event-espresso-8

As for the calendar feature, it is available in the core plugin and can be used to display datewise events to members.

Irrespective of which events plugin you use a very strong social networking website for offline events can be built using BuddyPress. The features are endless and we have only just got started. Watch out this space for more!

Did you find the post helpful? Is there something you’d like to add? Make your way to the comments sections and start typing away! 🙂

 

[space]

[space]

[freepik]

Aparna Gawade

Aparna Gawade

7 Responses

  1. You just made my life – and I have many of your other plugins, so thank you!

    One question – I am trying to simply allow group admins to create events FOR their groups, and restrain those events to the users in the groups. Would this be difficult to do with Event Espresso? I would really like to buy their plugin, it seems much better than Events Manager.

    Thank you again!

    1. Brandon, if you are keen on buying the Event Espresso plugin then you must. It’s feature rich and definitely works out to be cost effective in the long run.

      To fulfill your requirement some custom code will have to be written on the hook provided in step 3. If you are comfortable with coding it won’t be that difficult. Frankly, I had tinkered around a bit and have the code buried somewhere. I’ll definitely post it here if I’m able to find it.

  2. Thanks so much! Were you ever able to find that code? There is a very strange lack of buddypress group events plugins or functionality. Thanks!

  3. Hi, thank you svery much for your effort to make these two plugins work together.
    Unfortuntely I get the following error:
    Parse error: syntax error, unexpected ‘in’ (T_STRING) in /home/httpd/vhosts/lais-institut.ch/httpdocs/wp-content/themes/enfold/functions.php on line 549

    What to do?

  4. This looks good! I have a different requirement. I want to have an event that is publicly available and automatically add people who sign up to a group selected on creation of the event. The group would be a meeting place for all though who have attended a similar even.

  5. Hi,

    I have the same syntax error with “if(logged in user is not member of group) {“.
    How I can fix it?

    Best regards,
    Anna

Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

WordPress Development

Custom WordPress Solutions, for You

LearnDash Development

Custom LearnDash Solutions, for You

WooCommerce Development

Custom WooCommerce Solutions, for You

WordPress Plugins

Scale your WordPress Business

WooCommerce Plugins

Scale your WooCommerce Business

LearnDash Plugins

Scale your LearnDash Business

Label

Title

Subtext

Label

Title

Subtext

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads