0

Hey I want to prefill in new user details by setting the parameters in a link.

I am talking about the default Joomla User Manager in the BACKEND and then clicked on new user.

So this link,

administrator/index.php?option=com_users&view=user&layout=edit&id=0&jform_username=test

would already prefill in the username field with the word test.

I tried numerous suggestions from the web to make this work but sadly no luck. I also tried with different fields and switching between the name of the field and the ID jform[username] or jform_username.

1
  • Generally speaking, $_GET parameters (data visible in the url's query string) are to be used when performing READ-type operations on the server-side. When performing CREATE, UPDATE, DELETE operations, it is best practice to pass data via $_POST. One reason for this is that if a bot/hacker becomes aware of your links, they can mangle your users table in mere seconds via automated pageloading scripts. Whether or not this is a credible scenario for your project is not my point. It is a professional practice to split submitted data to CRUD operations in the way that I have described. Commented Nov 26, 2019 at 7:34

1 Answer 1

0

For security reasons, Joomla! uses a CSRF Token to secure any sensitive information in order to attempt to prevent any malicious form manipulation. The short answer you need the token to attempt to do this via url but it might not work. Your best bet would be to use your favorite web browser autofill capabilities. Take care.

2
  • Thank you for your answer I am going to look into this CSRF Token and see if it works. Commented Oct 26, 2019 at 18:40
  • Indeed Joomla! uses the CSRF Token and I did look briefly into it but decided to go with another way for creating the Joomla User in my extension. I do however like to keep the question open as there might be someone who can give an example with the CSRF Token included. This for future reference for all Joomla! users. Commented Nov 27, 2019 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.