Dave, I modified a bit your code to avoid the deprecated is_siteadmin() function.
Only the users who have the capabilities of editing profiles or modifying the site config will see and use the new function.
$sys_context = context_system::instance();
if ( has_capability('moodle/site:config', $sys_context) or has_capability('moodle/user:update', $sys_context) ) {
echo "<h2>Sending eMails</h2>";
flush();
echo "email address is:<a href='mailto:".$user->email."'>".$user->email."</a>";
if ($_GET['sendrenew']==1) {
if(setnew_password_and_mail($user)) {
echo "<br>Introductory email re-sent";
}
else {
echo "<br>Introductory email failed to send";
}
}
else {
echo "<br><br><a href='profile.php?id=".$user->id."&sendrenew=1'>Resend introductory email</a>";
}
}
unset($sys_context);