PHP code example of hypejunction / users_invite

1. Go to this page and download the library: Download hypejunction/users_invite library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hypejunction / users_invite example snippets



$invite = users_invite_create_user_invite($email);
add_entity_relationship($invite->guid, 'group_invite', $group->guid);
add_entity_relationship($invite->guid, 'invited_by', $inviter->guid);

// generate a registration link to handler('accept', 'invite', function($hook, $type, $return, $params) {

	$invite = $params['invite'];
	$user = $params['user'];

	$groups = elgg_get_entities_from_relationship([
		'relationship' => 'group_invite',
		'relationship_guid' => $invite->guid,
		'limit' => 0,
	]);

	if (!$groups) {
		return;
	}

	foreach ($groups as $group) {
		// Let users confirm individual group invitations
		add_entity_relationship($group->guid, 'invited', $user->guid);
	}
});