hi modxers. i need to be able to insert web login users using sql. i created a new test user in the modx /manager panel and i went into the mysql database to look for that test entry and i only see it in 2 mysql tables. can you confirm if that is correct please and if my info below is correct ? i also have a few questions for a few mysql fields below.
===============================
to insert one web user into mysql i first do this entry:
insert into modx_users(id,username,password,cachepwd,class_key,active,remote_key, remote_data,hash_class,salt, primary_group,session_stale,sudo,createdon)
values (‘’,‘genericwebuser2’,‘$2y$10$dhv2zdfqElZx2rOai1FjrusfOALCxpEHFn1VTHFA6zsEkQsAWbapq’,‘’,‘modxUser’,‘1’,‘’,‘’,‘hashing.modNative’, SALT-GOES-HERE??? , primary_group???, ‘’, ‘0’,‘TIMESTAMP-GOES-HERE’)
QUESTIONS:::::
----how do i set the ‘salt’? just stick in my own 32-character RANDOM entry?
----HOW DO I set the “primary_group”? it is not the group from the " modx_user_group_roles" table. but i need to keep it the same as the current webuser that i have which has a primary_group value of ‘4’ - that is the low-permission web user account group that i set up. i think i see that “4” in the " modx_membergroup_names" table and it looks correct that that is where the member groups are located.
----is a “sudo” value of ‘0’ ok for all new user entries?
#################################
i also see my new entry in the mysql table “modx_user_attributes”
for that entry i would use::::
INSERT INTO modx_user_attributes
(id
, internalKey
, fullname
, email
, phone
, mobilephone
, blocked
, blockeduntil
, blockedafter
, logincount
, lastlogin
, thislogin
, failedlogincount
, sessionid
, dob
, gender
, address
, country
, city
, state
, zip
, fax
, photo
, comment
, website
, extended
)
VALUES
(4, 4, ‘genericwebuser2’, ‘[email protected]’, ‘’, ‘’, 0, 0, 0, 0, 0, 0, 0, ‘327e43dh8347h34h348h’, 0, 0, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’);
-----the only values i need to consider are id
, internalKey
and sessionid. for “id” i will look for biggest current ‘id’ value in the table modx_user_attributes
and add 1 to it, correct?
--------do i just make internalKey
the same value as ‘id’ - that is how the current “modx_user_attributes” table appears to operate?
--------I can leave the sessionid value blank when i initially insert the new user, correct - and modx will edit it as required later?
--------is the “internalkey” in the “modx_user_attributes” table linked (the same) to the “id” field in the “modx_users” table?
---------anything else i need to consider?
------i don’t want a separate “username” and “email address” for the member logins - so can i just insert the email address for the username?
#############
any help would be appreciated.