Find:
Code:
$_PLUGINS->registerFunction( 'onBeforeUserUpdate', 'updateUser', 'jsmfCB');
Add After:
Code:
$_PLUGINS->registerFunction( 'onAfterUserUpdate', 'updateAfterUser', 'jsmfCB');
Find:
Code:
function updateUser($data, $extras, $status) {
Add After END OF FUNCTION!:
Code:
function updateAfterUser($data, $extras, $status) {
global $_PLUGINS;
global $jsmfConfig;
$jsmf = new jsmfFrontend();
$jsmfConfig = $jsmf->loadParams();
//Mike's hack
//Update smf_members with optional info like gender, MSN, website, location etc
global $database, $user;
$sql = "SELECT * FROM #__comprofiler WHERE `id` = '".$data->id."'";
$database->setQuery($sql);
$cbData = null;
$database->loadObject( $cbData );
if (!empty($cbData->cb_website)) {
$website = explode("|*|", $cbData->cb_website);
if (substr(htmlspecialchars($website[0], ENT_QUOTES),0,7) != "http://")
$websiteUrl .= "http://";
$websiteUrl .= htmlspecialchars($website[0], ENT_QUOTES);
$websiteTitle = ($website[1] != "") ? htmlspecialchars($website[1], ENT_QUOTES) : $websiteUrl;
}
$uid = $jsmf->getSMFid($data->id, $data->username);
$query =
"UPDATE {$jsmfConfig->smf_prefix}members SET " .
"\n `personalText` = '".htmlspecialchars($cbData->cb_personaltext, ENT_QUOTES)."', " .
"\n `gender` = '".(($cbData->cb_gender == 'Female') ? '2' : '1')."', " .
"\n `birthdate` = '".$cbData->cb_birthdate."', " .
"\n `websiteTitle` = '".$websiteTitle."', " .
"\n `websiteUrl` = '".$websiteUrl."', " .
"\n `location` = '".htmlspecialchars($cbData->cb_location, ENT_QUOTES)."', " .
"\n `ICQ` = '".htmlspecialchars($cbData->cb_icq, ENT_QUOTES)."', " .
"\n `AIM` = '".htmlspecialchars($cbData->cb_aim, ENT_QUOTES)."', " .
"\n `YIM` = '".htmlspecialchars($cbData->cb_yim, ENT_QUOTES)."', " .
"\n `MSN` = '".htmlspecialchars($cbData->cb_msn, ENT_QUOTES)."', " .
"\n `signature` = '".htmlspecialchars($cbData->cb_signature, ENT_QUOTES)."', " .
"\n `usertitle` = '".htmlspecialchars($cbData->cb_usertitle, ENT_QUOTES)."' " .
"\n WHERE `ID_MEMBER` = '".$uid."'";
$database->setQuery($query);
if (!$database->query()) {
$jsmf->err = $database->getErrorMsg().' ~~~ FROM::'.__FILE__.' || '.__FUNCTION__.' || '.__LINE__;
return false;
}
return true;
}
global $_PLUGINS;
global $jsmfConfig;
$jsmf = new jsmfFrontend();
$jsmfConfig = $jsmf->loadParams();
//Mike's hack
//Update smf_members with optional info like gender, MSN, website, location etc
global $database, $user;
$sql = "SELECT * FROM #__comprofiler WHERE `id` = '".$data->id."'";
$database->setQuery($sql);
$cbData = null;
$database->loadObject( $cbData );
if (!empty($cbData->cb_website)) {
$website = explode("|*|", $cbData->cb_website);
if (substr(htmlspecialchars($website[0], ENT_QUOTES),0,7) != "http://")
$websiteUrl .= "http://";
$websiteUrl .= htmlspecialchars($website[0], ENT_QUOTES);
$websiteTitle = ($website[1] != "") ? htmlspecialchars($website[1], ENT_QUOTES) : $websiteUrl;
}
$uid = $jsmf->getSMFid($data->id, $data->username);
$query =
"UPDATE {$jsmfConfig->smf_prefix}members SET " .
"\n `personalText` = '".htmlspecialchars($cbData->cb_personaltext, ENT_QUOTES)."', " .
"\n `gender` = '".(($cbData->cb_gender == 'Female') ? '2' : '1')."', " .
"\n `birthdate` = '".$cbData->cb_birthdate."', " .
"\n `websiteTitle` = '".$websiteTitle."', " .
"\n `websiteUrl` = '".$websiteUrl."', " .
"\n `location` = '".htmlspecialchars($cbData->cb_location, ENT_QUOTES)."', " .
"\n `ICQ` = '".htmlspecialchars($cbData->cb_icq, ENT_QUOTES)."', " .
"\n `AIM` = '".htmlspecialchars($cbData->cb_aim, ENT_QUOTES)."', " .
"\n `YIM` = '".htmlspecialchars($cbData->cb_yim, ENT_QUOTES)."', " .
"\n `MSN` = '".htmlspecialchars($cbData->cb_msn, ENT_QUOTES)."', " .
"\n `signature` = '".htmlspecialchars($cbData->cb_signature, ENT_QUOTES)."', " .
"\n `usertitle` = '".htmlspecialchars($cbData->cb_usertitle, ENT_QUOTES)."' " .
"\n WHERE `ID_MEMBER` = '".$uid."'";
$database->setQuery($query);
if (!$database->query()) {
$jsmf->err = $database->getErrorMsg().' ~~~ FROM::'.__FILE__.' || '.__FUNCTION__.' || '.__LINE__;
return false;
}
return true;
}
Forum 







