Created
July 1, 2012 22:32
-
-
Save ryelle/3029866 to your computer and use it in GitHub Desktop.
Meetup Login & BuddyPress integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function vs_meetup_bp_fields($user, $meetup) { | |
| global $wpdb; | |
| $wpdb->insert( | |
| $wpdb->prefix.'bp_xprofile_data', | |
| array( | |
| 'field_id' => 2, // meetup ID | |
| 'user_id' => $user->id, | |
| 'value' => $meetup->id | |
| ), | |
| '%d' | |
| ); | |
| $wpdb->insert( | |
| $wpdb->prefix.'bp_xprofile_data', | |
| array( | |
| 'field_id' => 3, // location | |
| 'user_id' => $user->id, | |
| 'value' => $meetup->city.', '.$meetup->state | |
| ) | |
| ); | |
| $wpdb->insert( | |
| $wpdb->prefix.'bp_xprofile_data', | |
| array( | |
| 'field_id' => 4, // introduction | |
| 'user_id' => $user->id, | |
| 'value' => $meetup->bio | |
| ) | |
| ); | |
| if (is_object($meetup->other_services) && !empty($meetup->other_services)){ | |
| if (array_key_exists('twitter',$meetup->other_services)){ | |
| $wpdb->insert( | |
| $wpdb->prefix.'bp_xprofile_data', | |
| array( | |
| 'field_id' => 5, // twitter | |
| 'user_id' => $user->id, | |
| 'value' => $meetup->other_services->twitter->identifier | |
| ) | |
| ); | |
| } | |
| } | |
| } add_action( 'meetup_user_create', 'vs_meetup_bp_fields', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| remove_action( 'meetup_user_create', array('VsMeetLogin', 'add_user_meetup_id'), 10, 2 ); | |
| function vs_meetup_get_wp_user($id, $meetup){ | |
| global $wpdb; | |
| $sql = "SELECT DISTINCT u.ID as id FROM {$wpdb->users} u LEFT JOIN {$wpdb->prefix}bp_xprofile_data pd ON u.ID = pd.user_id WHERE pd.field_id = 2 AND user_status = 0 AND pd.value = '%d' ORDER BY pd.value ASC"; | |
| return $wpdb->get_var( $wpdb->prepare( $sql, $meetup->id ) ); | |
| } add_filter( 'meetup_wp_user_id', 'vs_meetup_get_wp_user', 10, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function vs_meetup_new_user_redirect($url, $user){ | |
| return get_bloginfo('url') ."/members/". urlencode($user->display_name) ."/profile/edit/group/1"; | |
| } add_filter( 'meetup_login_new_user_redirect', 'vs_meetup_new_user_redirect', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment