Technology WordPress Solutions

Integrating BuddyPress and Event Espresso for a Meetup Website

Combining community features with event management makes for a lively meetup site. Here is how to integrate BuddyPress and Event Espresso for one, so members can connect and sign up for events in one place.

Aparna Gawade Aparna Gawade 8 min read

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
}

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

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

 

Get a FREE Consultation

Let's build something that lasts.

Share what's on your mind — a clear brief, a half-formed idea, or just a sense that something needs to change. We'll listen first, ask the right questions, and point you toward what's actually worth building.

We take on a handful of projects each quarter,ones where we can truly make a difference.

  • Receive a human response within 24 hours
  • Get a detailed scope and quote upfront
  • We're happy to sign an NDA upon request

    Free 30-Min Strategy Call

    Your Name *

    Your Phone No *

    Work Email *

    Your Budget*

    Project Details *