Solution:
I have had to do something similar before where a user had to click a link in an email and it automatically logged them in.
I added the following to my themes header.php
if (!is_user_logged_in())
{
if (isset($_GET['u']) && !empty($_GET['u']))
{
$u = $_GET['u'];
$result = $wpdb->get_row($wpdb->prepare("SELECT * FROM wp_users WHERE md5(concat(user_login,'SOMESECRETPHRASE',user_email)) = '%s' AND user_login != 'admin'",$u));
if (isset($result->ID) && isset($result->user_login))
{
wp_set_current_user($result->ID, $result->user_login);
wp_set_auth_cookie($result->ID);
}
}
}
The the users login link is created by Adding /?u=".md5($user_login."SOMESECRETPHRASE".$user_email)
To the end of the link
They will then automatically be logged into wordpress as the correct wordpress user.