Skip to Content Skip to Menu

can't access $input['username']

  • zederis
  • zederis
  • OFFLINE
  • Posts: 9
  • Thanks: 2
  • Karma: 1
6 months 3 weeks ago #337976 by zederis
can't access $input['username'] was created by zederis
Hello, I am using Auto Actions plugin and CB onAfterUpdateUser trigger with "Condition: password field - Not Empty". When the trigger fires, I need to get username and password. Also I don't want users to be able to edit their username, so I set it to "read only" in "Field Management" and/or set it to "Username Edit - No" in "User Profile Configuration". After disabling username editing, I can no longer access username from $input.

$input With username edit ENABLED =
{"view:"saveuseredit","option":"com_comprofiler","Itemid":111,"task":"saveuseredit","id":"348","6f553b1ee9a370f5b813fad82b229602":"1","username":"aaaaaa","email":"zederis@gmail.com","password__current":"zzzzzzzz","password":"aaaaaaaa","jform":{"params":{"editor":"","timezone":"","language":"","colorScheme":""}},"canvas__choice":"","avatar__choice":""}

$input With username edit DISABLED =
{"view:"saveuseredit","option":"com_comprofiler","Itemid":111,"task":"saveuseredit","id":"348","6f553b1ee9a370f5b813fad82b229602":"1","email":"zederis@gmail.com","password__current":"aaaaaaaa","password":"zzzzzzzz","jform":{"params":{"editor":"","timezone":"","language":"","colorScheme":""}},"canvas__choice":"","avatar__choice":""}

Is there another way to access username using onAfterUpdateUser trigger in Auto Actions with username edit disabled? Or do I have to go another route?
 

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
6 months 3 weeks ago - 6 months 3 weeks ago #337986 by krileon
Replied by krileon on topic can't access $input['username']
If username edit is disabled then there won't be any input data for it as the input doesn't submit with the post data since it can't be edited.

Ideally you should just be using user substitutions. So for example [username] will always give you their raw database stored username regardless of that setting. Recommend taking a look at our substitution tutorial below.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb

During profile update, if their password was changed, you should get the plaintext password with [password]. If it hasn't changed you'll get an empty string.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 6 months 3 weeks ago by krileon.

Please Log in or Create an account to join the conversation.

  • zederis
  • zederis
  • OFFLINE
  • Posts: 9
  • Thanks: 2
  • Karma: 1
6 months 3 weeks ago #337987 by zederis
Replied by zederis on topic can't access $input['username']
Tahnk you :)

Please Log in or Create an account to join the conversation.

  • zederis
  • zederis
  • OFFLINE
  • Posts: 9
  • Thanks: 2
  • Karma: 1
6 months 3 weeks ago #337989 by zederis
Replied by zederis on topic can't access $input['username']
hmm... in Auto Actions Parameters, Substitutions are enabled, but I have no clue how to make it work. I am outputting string in text file using:
file_put_contents("xxxxxx.txt", PHP_EOL . [username], FILE_APPEND | LOCK_EX);
or
$usernm = [username];
file_put_contents("xxxxxx.txt", PHP_EOL . $usernm, FILE_APPEND | LOCK_EX);

but it doesn't work. It seems like all tutorials or explanations start in the middle and doesn't explain from the start.. for a newbie like me. I spend hours upon hours experimenting and trying to make things work and it is getting very frustrating... :(

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
6 months 3 weeks ago #337990 by krileon
Replied by krileon on topic can't access $input['username']
Substitutions need to always be treated as strings. You're causing a PHP syntax error with your current code. Enable debug under parameters to see error output. So in your case change [username] to '[username]' and it should work fine.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • zederis
  • zederis
  • OFFLINE
  • Posts: 9
  • Thanks: 2
  • Karma: 1
6 months 3 weeks ago #337992 by zederis
Replied by zederis on topic can't access $input['username']
Yes! That works. But...
I need to sync password to another database every time it is being changed. When the user updates their password in profile settings I can easily access clear text password through the substitutions. But I can't figure out how to access the password when it is changed to random generated one during Forgot login process.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum