OK. I updated the instructions to include the group name and a link to the validation page. If you have already installed, do the following to upgrade:
Find:
Code:
if ($_POST['do'] == 'insertjoinrequest')
{
Add After:
Code:
require_once('./includes/functions_bbcodeparse.php');
require_once('./includes/functions_newpost.php');
Find the code block originally added in the hack.
Replace with:
Code:
$leaders = $DB_site->query("
SELECT ugl.userid, username
FROM " . TABLE_PREFIX . "usergroupleader AS ugl
INNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)
WHERE ugl.usergroupid = $usergroupid
");
$groupname = $DB_site->query_first("
SELECT title
FROM " . TABLE_PREFIX . "usergroup
WHERE usergroupid = $usergroupid
ORDER BY usergroupid DESC
LIMIT 1
");
if ($DB_site->num_rows($leaders))
{
$_groupleaders = array();
$tostring = array();
while ($leader = $DB_site->fetch_array($leaders))
{
// Send a PM to the leaders letting them know a join request has been made.
$message = construct_phrase($vbphrase['group_memberships_message'], $groupname[title]);
$message = convert_url_to_bbcode($message);
$tostring["$leader[userid]"] = $leader['username'];
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "pmtext\n\t(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature)\nVALUES\n\t($bbuserinfo[userid], '" . addslashes($bbuserinfo['username']) . "', 'Join Request:', '".addslashes(htmlspecialchars($message))."', '" . addslashes(serialize($tostring)) . "', 0, " . TIMENOW . ", 1)");
$pmtextid = $DB_site->insert_id();
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "pm (pmtextid, userid, messageread) VALUES ($pmtextid, $leader[userid], 0)");
$DB_site->shutdown_query("UPDATE " . TABLE_PREFIX . "user SET pmtotal=pmtotal+1, pmunread=pmunread+1 WHERE userid = $leader[userid]");
}
}