Quote:
Originally Posted by cynix2
after a good long while of testing i finally fixed up this hack
the main problem that existed was the bbcode was being parsed in the hack, when it didnt need to be, vb will parse the bbcode when displaying the pm, so i then proceeded to use bbcode to construct the phrase for the pm
the second thing i fixed was the url issue, i was on the right track using {2} in my last post above but i put the wrong variable into the hack, so now it works just fine
anyways here are the new updated files, amykhar you might wanna update the hack so people dont have to come to the last page to see it needed fix'n
|
Is this the same file that you download from the side bar?
Code:
product - vbulletin
hooklocation - profile_insertjoinreques
title - PM Group Leader on Join Request
Plugin PHP Code -
require_once(DIR . '/includes/class_bbcode.php');
// Find the leaders of the usergroup
$leaders = $db->query_read("
SELECT ugl.userid, username
FROM " . TABLE_PREFIX . "usergroupleader AS ugl
INNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)
WHERE ugl.usergroupid = " . $vbulletin->GPC['usergroupid'] . "
");
// Get the name of the member group
$groupname = $db->query_first("
SELECT title
FROM " . TABLE_PREFIX . "usergroup
WHERE usergroupid = " . $vbulletin->GPC['usergroupid'] ."
ORDER BY usergroupid DESC
LIMIT 1
");
// Create the message:
$message = construct_phrase($vbphrase['group_memberships_message'], $groupname['title'], $vbulletin->options['bburl']);
if ($db->num_rows($leaders))
{
while ($leader = $db->fetch_array($leaders))
{
// create the DM to do error checking and insert the new PM
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set('fromuserid', $vbulletin->userinfo['userid']);
$pmdm->set('fromusername', $vbulletin->userinfo['username']);
$pmdm->set('title', $vbulletin->userinfo['username']. " would like to join " . $groupname['title']);
$pmdm->set('message', $message);
$pmdm->set_recipients($leader[username], $botpermissions);
$pmdm->set('dateline', TIMENOW);
$pmdm->set_info('savecopy',0);
$pmdm->save();
}
}
else {
eval(standard_error(fetch_error('usergroup_already_member')));
}
// End of mod
plugin is active - yes
Edit, I edited this post so it will help other people, I finally got it working, yay!!