From 58c90b815af6a496a89bf09e51d0de18baa653a2 Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Fri, 28 Jun 2019 11:54:01 +0200 Subject: [PATCH] Updated 024 How to integrate the Create User Helper Method in your Components (markdown) --- ...Create-User-Helper-Method-in-your-Components.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/024-How-to-integrate-the-Create-User-Helper-Method-in-your-Components.md b/024-How-to-integrate-the-Create-User-Helper-Method-in-your-Components.md index 52f5fe1..c350ad0 100644 --- a/024-How-to-integrate-the-Create-User-Helper-Method-in-your-Components.md +++ b/024-How-to-integrate-the-Create-User-Helper-Method-in-your-Components.md @@ -9,21 +9,23 @@ What is the User Creation function? [00:00:18](https://www.youtube.com/watch?v=c I'm going to close out here. I am going to go back to the code. Then I am going to do a simple . [00:02:44](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m44s) -If this area is closed and you return to the code and a simple search for user is done, quite a few users can be seen as well as Create User. +If this area is closed and you return to the code and a simple search for user is done, quite a few users can be seen as well as 'Create User'. ### 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 the correct code as everything else is not automatically sets in place. +This is a public static function. It may be called 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, as well 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. 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. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +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 'Expert' 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. [00:06:05](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m05s) Then it indicates that it is ready to be selected and 'testing123' which has been created from the user list in the above field may now be selected. Click on the blue user icon and type in that 'testing123' and click 'Search'. + As the user is now created, 'enter' may be clicked . A very strange conversion may be noticed, it converted the username's numbers to letters. [00:06:40](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m40s) This application doesn't allow any numbers in the user name, but anyhow this integrated user has been connected to an 'Expert'. If you were to click there again, it may still be selected, but once it is selected, you can not create a new 'Expert' and select that user again. Thus it is 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) + +A lot of JavaScript may be noticed on this page and here(See video) has this job tracking extension been written. If for example a new job order needs to be created, then it can be indicated whether it is a new client or a existing one. If it is an existing, simply select from the list. [00:08:04](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m04s) If it's new, click 'A new Client'. All the details of the user can be entered and when 'save' is clicked, it creates the user, stores the data in the user table, but not in the job order table and deletes all these values (the job order table never stores any user values in the relation of this job order). + +If this closed, open a 'New client'. The same values can be seen. [00:08:44](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m44s) This is another way to integrate this whole user integration. <<<<<<<<<<<<<<<<<<<<<, -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. ### Make Use Of The Ajax Concept