Posts: 3,564
Threads: 36
Joined: Apr 2014
Reputation:
49
the correct syntax is $user_password$
but that works only when sent through the activation of the contact (I think)
Joe
TSolucio
Posts: 11
Threads: 3
Joined: Feb 2021
Reputation:
2
i thinks it's related with system upgrade on activatePortalFieldsContacts
even when i tried to disable this upgrade the field that cames with it still there
and normal uldate of the vtiger_portalinfo stoped working and the system
don't add new credentials to this table
also have this 2 uprades related enabled
updatePortalinfoUsernameFieldType
delSettingsCPortalWebform
i thougt to add this proglem to github but still not sure if is related to the MYC portal interconection
global variable for this its correct? (Application_Customer_Portal_BeingUsed vtigercrmportal)
Posts: 11
Threads: 3
Joined: Feb 2021
Reputation:
2
02-26-2021, 05:44 PM
(This post was last modified: 02-26-2021, 05:44 PM by Victor Burgueño.)
searching i ad found that the function invoqued from the worqflow its SendPortalLoginDetails
the function that seems to be making this work it's Contacts_sendCustomerPortalLoginDetails
in Contactshandler.php
i had get the solution of activating the customer portal enabling this function on a workflow
but still it dont send the email maibe becouse it don't find the tempate... how it indicates which is the temlate
to be sended?
this function also seems to update the activation if the portal user is not disabled and disabling it on the database
but it doesnt work for me...
function Contacts_sendCustomerPortalLoginDetails($entityData) {
$adb = PearDatabase::getInstance();
//$moduleName = $entityData->getModuleName();
$wsId = $entityData->getId();
$parts = explode('x', $wsId);
$entityId = $parts[1];
$email = $entityData->get('email');
if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
$result = $adb->pquery('SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?', array($entityId));
$insert = false;
if ($adb->num_rows($result) == 0) {
$insert = true;
} else {
$dbusername = $adb->query_result($result, 0, 'user_name');
$isactive = $adb->query_result($result, 0, 'isactive');
if ($email == $dbusername && $isactive == 1 && !$entityData->isNew()) {
$update = false;
} elseif ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
$adb->pquery('UPDATE vtiger_portalinfo SET user_name=?, isactive=1 WHERE id=?', array($email, $entityId));
$password = $adb->query_result($result, 0, 'user_password');
$update = true;
} else {
$adb->pquery('UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?', array($email, 0, $entityId));
$update = false;
}
}
if ($insert == true) {
$password = makeRandomPassword();
$adb->pquery(
'INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)',
array($entityId, $email, $password, 'C', 1)
);
}
if ($insert == true || $update == true) {
require_once 'modules/Emails/mail.php';
global $current_user;
$emailData = Contacts::getPortalEmailContents($entityData, $password, 'LoginDetails');
$subject = $emailData['subject'];
$contents = $emailData['body'];
send_mail('Contacts', $entityData->get('email'), $current_user->user_name, "", $subject, $contents);
}
} else {
$adb->pquery('UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?', array($email, $entityId));
}
}