Skip to content

Instantly share code, notes, and snippets.

@bappi-d-great
Created September 9, 2014 13:41
Show Gist options
  • Save bappi-d-great/3410541d56bca39e2255 to your computer and use it in GitHub Desktop.
Save bappi-d-great/3410541d56bca39e2255 to your computer and use it in GitHub Desktop.
Add all users in a buddypress group
<?php
/*
* Needs php greatet than 5.3
*
* (not for all, written for special purpose)
*/
add_action('load-users.php',function() {
if(isset($_GET['action']) && isset($_GET['bp_gid']) && isset($_GET['users'])) {
$group_id = $_GET['bp_gid'];
$users = $_GET['users'];
foreach ($users as $user_id) {
groups_join_group( $group_id, $user_id );
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment