Updated 024 How to integrate the Create User Helper Method in your Components (markdown)

Amigo 2019-06-28 10:02:47 +02:00
parent f3f15739fc
commit 55474faf58
1 changed files with 4 additions and 3 deletions

@ -14,13 +14,14 @@ If this area is closed and you return to the code and a simple search for user i
### Create User
This is a public static function. So you would basically call it with that class name 'expertdatabasehelper' then 'colon' 'colon' and the name of the function, which is Create User. It is set to '$new'. [00:03:26](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m26s) '$new' has in it a few variables, it is an array. In this class it may be noticed that it has a password: 'password2'. It has a user name, it has a name, aswell as a e-mail. Then it creates the user, that's what this class does. It calls in the Joomla component users. [00:04:00](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m00s) It calls in it's registration model and it uses that model to create a user. That's what that switch does, it adds this class to the component. The it may be used it in the component. It doesn't just sets everything else in place, It is still required of the developer to add to correct code as everything else is not automatically sets in place.
This is a public static function. So you would basically call it with that class name 'expertdatabasehelper' then 'colon' 'colon' and the name of the function, which is Create User. It is set to '$new'. [00:03:26](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m26s) '$new' has in it a few variables, it is an array. In this class it may be noticed that it has a password: 'password2'. It has a user name, it has a name, aswell as a e-mail. Then it creates the user, that's what this class does. It calls in the Joomla component users. [00:04:00](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m00s) It calls in it's registration model and it uses that model to create a user. That's what that switch does, it adds this class to the component. The it may be used it in the component. It doesn't just sets everything else in place, It is still required of the developer to add the correct code as everything else is not automatically sets in place.
### Expert Field
There is a admin view called 'Experts'. For example: If there is a need in this view like the option for someone to create a User. To demonstrate how it works. Go to expertdatabase and click on 'Experts' and click on 'New'. [00:04:55](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m55s) A field called 'Expert' may be seen in which you can select users within a specific group. Underneath is the button Create User. <<<<<<
There is a admin view called 'Experts'. For example: If there is a need in this view like the option for someone to create a User. To demonstrate how it works. Go to expertdatabase and click on 'Experts' and click on 'New'. [00:04:55](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m55s) A field called 'Expert' may be seen in which you can select users within a specific group. Underneath is the button Create User. It has a pop-up where a user name may be entered . For instance 'Testing123' may be used for the name as well as the username, and 'Testing123@vdm.io' as e-mail and as the password. [00:05:26](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m26s) If 'Create' is clicked, it creates it, setting it up, sending out the email. Once it's done it informs you that the user was created successfully and the login details had been e-mailed to the user. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If you click on it, it basically has a pop-up where in you enter a user name. I am just going to say 'Testing123' as the username. [00:05:26](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m26s) And as the password, there we go, got the user name. So everything is testing123. If I click create, it basically has this nice effect where it is busy creating it, setting it up, sending out the email, doing all of that for you. And once it's done it lets you know that the user was created successfully and the login details was e-mailed to the user. Then it says here ready to select. [00:06:05](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m05s) You can now select testing123 that you just created from the user list in the above field. Simply click on the blue user icon. Click here and you can type in that testing123, click search. There is the user created and we click enter. You see that it basically used a very strange conversion here. Basically converting the username away from the numbers. Now you can you can fix that by clicking edit. [00:06:40](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m40s) Then changing it to 123 and say save the update. Clearly my little application doesn't want to allow you to use any numbers in the user name. That's not the point. The point is that we have this integrated user now that is connected to an expert. If you were to click there again, you can still select it, but once you select it, you can't create a new expert and select that user again. So it's basically one profile connecting to one user to set up a expert. [00:07:24](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m24s) So that's the feature I'm using it for there is different ways that I have implemented this.
Then it says here ready to select. [00:06:05](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m05s) You can now select testing123 that you just created from the user list in the above field. Simply click on the blue user icon. Click here and you can type in that testing123, click search. There is the user created and we click enter. You see that it basically used a very strange conversion here. Basically converting the username away from the numbers. Now you can you can fix that by clicking edit. [00:06:40](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m40s) Then changing it to 123 and say save the update. Clearly my little application doesn't want to allow you to use any numbers in the user name. That's not the point. The point is that we have this integrated user now that is connected to an expert. If you were to click there again, you can still select it, but once you select it, you can't create a new expert and select that user again. So it's basically one profile connecting to one user to set up a expert. [00:07:24](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m24s) So that's the feature I'm using it for there is different ways that I have implemented this.
Let me show you another one. Obviously you realise I'm using a lot of JavaScript on this page. I will show you some of that JavaScript but for the most part you need to write that yourself. For example over here I wrote this job tracking extension. Let's say we want to create a new job order, then I can say whether it's a new client or a existing. If it is an existing I simply select from this list. [00:08:04](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m04s) If it's new I click here(A new Client) I can enter all the details of the user and when I click save, it creates the user, stores the data in the user table, not in the job order table. Deletes all these values, that the job order table never stores any user values in the relation of this job order of course. And so that's another way that I have implemented. If we were to close this out, open a client, a new one. You would see it's basically it's the same values. [00:08:44](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m44s) So that's another way that we integrated this whole user integration. So there are really many different ways to this. The way I have done it I've just listen to my clients expectation. What I really would like to see and how they would like it to work, then simply make it happen that way. I personally prefer the Ajax way much more. It just seems to me easier.