/**
 * Adds timestamp and token to the registration link
 *
 * @param string         $hook
 * @param string         $type
 * @param ElggMenuItem[] $menu
 * @param array          $params
 * @return ElggMenuItem[] $menu
 */
function registration_randomizer_login_menu($hook, $type, $menu, $params)
{
    foreach ($menu as $key => $item) {
        if ($item->getName() == 'register') {
            $info = registration_randomizer_generate_token();
            $item->setHref('/register/' . $info['ts'] . '/' . $info['token']);
        }
    }
    return $menu;
}
/**
 * Checks if the token and ts are valid
 *
 * @param type $token
 * @param type $time
 * @param type $req
 * @return bool
 */
function registration_randomizer_is_valid_token($token, $time, $req = null)
{
    return $token === registration_randomizer_generate_token($time, $req);
}
<?php

/**
 * Provides a link to the registration URL
 */
$info = registration_randomizer_generate_token();
$vars['href'] = '/register/' . $info['ts'] . '/' . $info['token'];
echo elgg_view('output/url', $vars);