Hi,
I try to create new users dynamically. But, I don't find the funtction of this (in user.php or logger...)
Can you help me please ?
Thank you,
Thomas
Hi,
I try to create new users dynamically. But, I don't find the funtction of this (in user.php or logger...)
Can you help me please ?
Thank you,
Thomas
Hi,
I try this but i have an error because the save funtion doesn't record anything in the database ? Why ?
require_once('log4php/LoggerManager.php');
require_once('include/formbase.php');
require_once('modules/Candidats/Candidat.php');
require_once('include/database/PearDatabase.php');
require_once('modules/Users/User.php');
require_once('include/database/DBManager.php');
global $mod_strings;
global $db;
$user = new User();
$candidat = new Candidat();
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'].": ", true);
echo "\n</p>\n";
$user = populateFromPost('', $user);
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once($theme_path.'layout_utils.php');
//Message d'erreur si id est null...
if(!isset($_REQUEST['record'])) //record == id
sugar_die($mod_strings['ERR_DELETE_RECORD']);
// Traitement du candidat à partir de son id...
// Création d'un user au nom du candidat...
$user->first_name = $_REQUEST['candidat_first_name'];
$user->last_name = $_REQUEST['candidat_last_name'];
$user->id = $_REQUEST['candidat_id'];
$candidat_first_name = $user->first_name;
[....]
$user->user_name = $candidat_login;
$date_entered_modified = date("Y-m-d H:i:s");
$user->date_entered = $date_entered_modified;
$user->date_modified = $date_entered_modified;
$user->save($GLOBALS['check_notify']); <= ???????????????????????????????
[.....]
Hi,
Nobody have an idea![]()
I try another method but it is not really interesting... So if you have an idea.... Help me please !
Thomas
Hi There, when you create a new user from the Admin it calls the EditView action of the User Module. The save feature part of the main app so you can't just call 'save' . Your best bet is to create your own function that you can call.Originally Posted by Tom79
I know for Opportunities. we tried to do the same thing you want. We noticed that for the Opportunity it loads OpportunityFormBase and then calls the method handleSave();
This appears to be standard for most of the modules.
I would do something like this
//Maybe pass it a user object
include_once('include/utils.php');
function save($User){
$User->id = create_guid(); //this comes from the include file
Create a sql statement to insert into the table
since your class extends Sugar bean
you can call
$this->db->query($sql);
Good Luck
}
Thank you, it's perfect !
Thomas
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks