Getting invitation from address bar and sending it with the validation mail

Hello!

I'm trying to figure how to get a variable from URL bar. Let's say an invitation directs the user here /elgg/register?friend_guid=35&invitecode=123 . Say I want to use the variables in a mod

the register.php has it like his

$friend_guid = (int) get_input('friend_guid', 0);
$invitecode = get_input('invitecode');

I'm using user validion by admin (very similar than user validion by email). How can I use those two variables in a mod? 

It sends email like this (views/function.php):

function uservalidationbyemail_request_validation($user_guid, $admin_requested = FALSE) {

$site = elgg_get_site_entity();

$user_guid = (int)$user_guid;
$user = get_entity($user_guid);

if (($user) && ($user instanceof ElggUser)) {
// Work out validate link
$code = uservalidationbyemail_generate_code($user_guid, $user->email);
$link = "{$site->url}uservalidationbyemail/confirm?u=$user_guid&c=$code";


// Send validation email
$subject = elgg_echo('email:validate:subject', array($user->name, $site->name));
$body = elgg_echo('email:validate:body', array($user->name, $site->name, $link, $site->name, $site->url));
$result = notify_user($user->guid, $site->guid, $subject, $body, NULL, 'email');

if ($result && !$admin_requested) {
system_message(elgg_echo('uservalidationbyemail:registerok'));
}

return $result;
}

return FALSE;
}

 

How can I get the $friend_guid and $invitecode sent with the same email?

 

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking