Emma PHP :: Group Functions

The Group functions in the library are used to maintain the member groups in your Emma account (creating, renaming, deleting) as well as some higher-level functions to add and remove members from groups. There are also functions for retrieving lists of groups, as well as specific details for individual groups.

Adds a list of members to a single group.

Arguments:

  • int $member_group_id - Group you're adding the members to
  • int or array of int $member_ids - Member IDs to add to the group

Use:


require_once('../../MyEmmaPHP.php');

try {
	
	$me = new MyEmmaPHP();
  
	$member_ids = array(236900, 236900, 245092);
	$member_group_id = 10596;
	
	$retval = $me->addMembersToGroup($member_group_id, $member_ids);
	print_r($retval);
	
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}

Wrapper for: add_members_to_group

Copy all the users from one group to another.  You must specify the status ID(s) of users you wish to include in the copy.

Arguments: 

  • int $source_group - The group ID of the group from which you want to copy
  • int $target_group - The group ID of the group you want to copy the members into
  • string or array of string $member_status_id- The status ID(s) of the members you want to include in the copy.  Valid values are:
    • 'a' - Active
    • 'o' - Opt out
    • 'e' - Error

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
  
	$from_group = 17764;
	$to_group = 10596;
	$member_status_id = 'a';
	
	$retval = $me->copyGroupToGroup($from_group, $to_group, $member_status_id); 
	print_r($retval);
	
	    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: copy_group_to_group

Create one or more new member groups in Emma.

Arguments: 

  • string or array of strings $group_names - The names of the new group(s)

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
	
	/*
	** Adding a single group
	*/
	$retval = $me->createGroups('Annoying People');
	print_r($retval);
	
	/*
	** Adding an array of groups
	*/
	$new_group_names = array('Silly People', 'Smart People');
    
    $retval = $me->createGroups($new_group_names);
	print_r($retval);
	    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: create_groups

Delete a single member group in Emma.

Arguments: 

  • int $group_id - The group ID of the group you want to delete from your Emma account

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
  
	$retval = $me->deleteGroup(31076);
	
	if ($retval) {
		echo "Group deleted successfully.\n";
	} else {
		echo "Group not deleted.\n";
	}
	    
	    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: delete_group

Retrieve the details of a single member group in Emma.

Arguments: 

  • int $group_id - The group ID of the group you want to retrieve the information for in your Emma account.

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
   
    $retval = $me->getGroupDetail(20836);
   
	print_r($retval);
        
    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: get_group_detail

List the members that belong to a single group in Emma.

Arguments: 

  • int $group_id - The group ID you want to retrieve the member list for

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
   
    $retval = $me->listGroupMembers(13668);
   
	print_r($retval);
        
    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: list_group_members

Lists all the groups in the account.

Arguments: none

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
   
    $retval = $me->listGroups();
   
	print_r($retval);
        
    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: list_groups

Remove all members from a single group in Emma.

Arguments: 

  • int $group_id - The group ID you want to remove members from

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
  
	$group = 10596;
	$retval = $me->removeAllMembersFromGroup($group); 
	print_r($retval);
	
	    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: list_group_members

Remove specific members from a single group in Emma.

Arguments: 

  • int $group_id - The group ID you want to remove members from
  • int, or array of int $members_to_remove - The group ID you want to remove members from

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
  
	$members_to_remove = array(236900, 245092);
	$group = 10596;
	
	$retval = $me->removeMembersFromGroup($group, $members_to_remove);
	print_r($retval);
	
	    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: list_group_members

Rename a group in Emma.

Arguments: 

  • int  $group_id - The group ID of the group you want to update.
  • string  $group_name - The new name for the group.

Use:


require_once('../../MyEmmaPHP.php');

try {

	$me = new MyEmmaPHP();
	
	$retval = $me->updateGroup(20836, 'OHUG Test Integration');
	
	if ($retval) {
		echo "Group updated successfully.\n";
	} else {
		echo "Group not updated.\n";
	}
	    
} catch ( Exception $e ) {
    echo $e->getMessage() . "\n\n";
}



Wrapper for: update_group

Keep in Touch

Contact Us

Buzz

Loading...

People talking about '@synergycode':