Meetup Login allows users to log in to your WordPress site using their meetup.com account. If user registration is enabled & an existing user can’t be found, it creates a new user. Currently there’s no easy way to hook up an existing user to a meetup ID.
Grab it on GitHub here, but do read this post before using.
Why use Meetup Login?
- If you’ve got a Meetup group with a related BuddyPress site, as I know a few WP meetups do, there’s no easy way to connect the two. Having to create a second account separate from meetup.com might also be putting off some users (but the option to purposely create an account separate can still exist).
- If you’ve got a Meetup group with a related WordPress site (maybe where you post announcements), you can use Meetup Login to connect post authors there to their Meetup.com accounts.
- If you have a Meetup account & don’t want to remember another user/pass for your WordPress site, you can just use Meetup as a login.
Meetup Login is almost ready for widespread release, however I’d really like to get in contact with a few people/groups to have them test it. If you’d like to help out, you can download the plugin from github & let me know by commenting here. If you find anything wrong, you can report issues at github, and feel free to fix if you find anything wrong or even if you just want to improve it.
Documentation
While this plugin will work just fine with minimal configuration, the real power of it will be in making it work with your site. The default behavior is to create a user account with the meetup ID number as user meta, and then to find that meta value when the user logs in again.
There are hooks created so that you can use any method you want to store the connection between meetup user & WP user. There is no way to do this outside of code, and I don’t plan on adding or supporting one. The action/filter reference can be found on the github readme.
Walkthrough
hint
Use the meetup.com API console to learn what fields are returned when the user is retrieved (use relation = self).
Goal: The Western MA WordPress Meetup (that I run) has a BuddyPress site, so I wanted to auto-populate some extra profile fields (location, introduction, etc) with information provided from the meetup.com request. These fields already exist, I created them in the admin under BuddyPress > Profile Fields.
I also want the login to redirect to the BuddyPress profile edit screen on new-user creation.
hint
If you’re unfamiliar with actions & hooks, start at the codex.
Approach: I hooked into Meetup Login in three places. First, I added an action after the WP user is created, using the meetup_user_create
hook. This gives you two variables, the created user object & the meetup user object.
Using the profile fields I’d already created, I inserted the Meetup information into the BuddyPress profile fields table (yes, directly into the DB, let me know if there’s a better way).
Next, since we’re adding the Meetup ID to the buddypress profile, I’m going to disable the default way of storing Meetup ID in usermeta & make the plugin instead look at the BP Profile.
Here I’m removing the default action on meetup_user_create
& overriding the user lookup. By default, this function searches for usermeta matching the meetup ID, but then also passes the ID through a filter, along with the meetup object. By hooking into this filter, we can run a check on the user ID, or completely override it (as I’m doing here).
Finally, I want the new user to be redirected to their edit-profile screen, so that they can check & change anything that was autofilled incorrectly, or fill out any other fields that don’t come from Meetup.com.
In this case, I’m just returning a string URL that will be used instead of the default redirect to the WP user profile.
Applying this to an existing site
There currently is no automated way for existing users to hook up their meetup accounts, though this will probably change in an updated version.