Title: [Plugin: EventPress] Event Invitations
Last modified: August 19, 2016

---

# [Plugin: EventPress] Event Invitations

 *  [Micah Wood](https://wordpress.org/support/users/woodent/)
 * (@woodent)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-eventpress-event-invitations/)
 * Kunalb,
 * Sorry if I am bugging you too much, but there is one other question I have. For
   any given event, the user has the ability to send invitations out for the event.
   Currently, all of the members in the directory appear on the ‘Send Invites’ section.
   I saw that you are using the get_inviteable_ids() function to put this query 
   together.
 * What would be the easiest way for me to limit a user’s ability to send invites
   to just that user’s friends? We prefer that users can’t invite all the users 
   on the site, as this list is going to be quite large.
 * [http://wordpress.org/extend/plugins/eventpress/](http://wordpress.org/extend/plugins/eventpress/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [kunalb](https://wordpress.org/support/users/kunalb/)
 * (@kunalb)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-eventpress-event-invitations/#post-1749116)
 * Easiest would be to override the inviteableids list generated by that function
   using the filter ep_inviteable_ids. I made a rather complex query to find people
   who hadn’t already been invited, etc. etc. which is captured in get_inviteable_ids(
   ep/models/registration.php)
 *  Thread Starter [Micah Wood](https://wordpress.org/support/users/woodent/)
 * (@woodent)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-eventpress-event-invitations/#post-1749340)
 * For anyone trying to do the same thing, here is the code that I dropped into 
   my theme’s function.php file:
 *     ```
       add_filter('ep_inviteable_ids', 'get_just_friends');
       function get_just_friends($data){
         global $wpdb;
         $user_id = get_current_user_id(); // WP Function
         if( !friends_check_user_has_friends($user_id) ) return FALSE;
         $friends = friends_get_friend_user_ids($user_id); // BP Function
         $friend_count = friends_get_total_friend_count($user_id); // BP Function
         $friend_set = NULL;
         $i = 1;
         foreach($friends as $friend){
           $friend_set .= 'ID = '.$friend;
           if( $i != $friend_count ) $friend_set .= ' OR ';
           $i++;
         }
         $query = "SELECT ID, user_email, user_nicename, display_name, display_name AS value FROM ".$wpdb->users." WHERE ".$friend_set;
         $data = $wpdb->get_results($query);
         return $data;
       }
       ```
   
 * Thanks for your help on this!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: EventPress] Event Invitations’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/eventpress.svg)
 * [EventPress](https://wordpress.org/plugins/eventpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/eventpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/eventpress/)
 * [Active Topics](https://wordpress.org/support/plugin/eventpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/eventpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/eventpress/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Micah Wood](https://wordpress.org/support/users/woodent/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-eventpress-event-invitations/#post-1749340)
 * Status: not resolved