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

Amigo 2019-07-16 17:41:53 +02:00
parent 55de34d324
commit e27ef0483a

@ -2,55 +2,51 @@
[00:00:00](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s) [00:00:00](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s)
What is the User Creation function? It is basically a part of code's helper function that gets added to the Helper class. What is the User Creation function? It is a part of code's helper function that is added to the Helper class.
### Helper Class ### Helper Class
[00:00:32](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m32s) [00:00:32](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m32s)
If the repository is opened you will find Joomla Install, go to administrator. There is a Helper class for the front end of every component as well as for the back end. Looking in a back end, in component there is 'com_expertdatabase'. and under it 'expertdatabase.php'. [00:00:55](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m55s) Go to Helpers, that file(See video), is the Helper class. If it is opened the abstract 'expertdatabaseHelper' may be seen. That Helper class gets included into the component on every page. If the main back end file with that one 'expertdatabase' is opened, which get loaded by Joomla first. It includes that Helper file in every page. [00:01:28](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m28s) It means that everything in that class is available everywhere in the component. Returning to the interface, Component Builder Dashboard, and then go to components and to 'expertdatabase'. There can Library & Helpers be seen . The switch 'add create user helper method', is in the 'yes' position. [00:02:11](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m11s) That is the switch that should be used, by which Component Builder is commanded that the Helper class that creates Users should be added to the Helper class of the front and back end of the component. [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 the repository is opened, find Joomla Install and go to administrator. There is a Helper class for the front end of every component as well as for the back end. In a back end in component there is 'com_expertdatabase'. and under it 'expertdatabase.php'. [00:00:55](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m55s) Go to Helpers. This file is the Helper class. (See video.) If it is opened the abstract 'expertdatabaseHelper' may be seen. This Helper class gets included into the component on every page. If the main back end file with 'expertdatabase' is opened it gets loaded by Joomla first. It includes the Helper file in every page. [00:01:28](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m28s) Everything in the class is available everywhere in the component. Return to the interface, Component Builder Dashboard, and go to components and 'expertdatabase'. Library & Helpers be seen there. The switch 'add create user helper method', is in the 'yes' position. [00:02:11](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m11s) It is the switch that should be used by which Component Builder is commanded that the Helper class, creating Users, should be added to the Helper class of the front and back end of the component. [00:02:44](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m44s) If the area is closed and you return to the code and a simple search for User is done, a few users can be seen, as can 'Create User'.
### Create User ### Create User
[00:03:00](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m00s) [00:03:00](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m00s)
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. This is a public static function. It may be called with the class name 'expertdatabasehelper', 'colon', 'colon' and the name of the function: Create User. It is set to '$new'. [00:03:26](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m26s) '$new' has a few variables in it; it is an array. It may be noticed that it has a password in this class: 'password2'. It has a user name, a name, and an e-mail. This class then creates the user. 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 its registration model and uses the model to create a user. That's what the switch does, adding this class to the component. The it may be used it in the component. It doesn't just set everything else in place, the developer is still required to add the correct code since everything else is not automatically set in place.
### Expert Field ### Expert Field
[00:04:30](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m30s) [00:04:30](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m30s)
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'. There is a admin view called 'Experts'. If there is a need in this view, for example, the option for someone to create a User, this demonstrates how it works. Go to 'expertdatabase', click on 'Expert' and 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 the e-mail and the password. [00:05:26](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m26s) If 'Create' is clicked, it creates and sets 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, type in 'testing123' and click 'Search'. 'Enter' may be clicked as the user had now been created. A 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 numbers in the user name, but this integrated user had been connected to an 'Expert'. If you were to click there again, it may still be selected; but once selected, you can not create a new 'Expert' and select the user again. So one profile connects to one user to set up a 'Expert'. [00:07:24](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m24s)
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). A lot of JavaScript may be noticed on this page. Here this job tracking extension has been written. (See video.) If for example a new job order has to be created, it can indicate whether it is a new client or a existing one. If it is an existing client, 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 the user integration.
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.
### Make Use Of The Ajax Concept ### Make Use Of The Ajax Concept
[00:09:30](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m30s) [00:09:30](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m30s)
In previous tutorials it had been explained how to make use of the Ajax concept within Component Builder. Here is a quick overview for those that would like to understand what happens at code level. How does the code look which had been used for a Ajax? [00:09:26](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m26s) In previous tutorials it had been explained how to make use of the Ajax concept within Component Builder. Here is a quick overview for those of you who would like to understand what happens at code level. How does the code that had been used for a Ajax look? [00:09:26](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m26s)
Return to the Expert view. Return to the Expert view.
Within every component that makes use of Ajax, a model and a controller is created. The controller is named 'Ajax.json.php' and the model is named 'Ajax'. [00:10:04](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m04s) Open the model and the controller. As may be seen the controller gives the register commands within the construct method and adds the tasks to a switch, and makes an attempt to run the task. [00:10:31](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m31s) In the model it gets the model Ajax, and then runs the method that corresponds to the task. Within every component that makes use of Ajax, a model and a controller is created. The controller is named 'Ajax.json.php' and the model 'Ajax'. [00:10:04](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m04s) Open the model and the controller. As may be seen the controller gives the register commands within the construct method, adds the tasks to a switch, and makes an attempt to run the task. [00:10:31](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m31s) In the model it gets the model Ajax, then runs the method that corresponds to the task.
It uses the Joomla's default filtering method in a way that it gets values that has been posted and validates if those values are actually there. The values are then transfered to the model. [00:11:05](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m05s) That is looking at it from a code perspective. Various methods are displayed in the model and some of them are protected, and some of them are public. Those 'getcreateuserfields' are usually the ones that gets called from the controller once the Ajax gets the verification level and it is verified. Here is the 'createUser' class. [00:11:31](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m31s) First check whether this user, (it is custom script, Component Builder does not write this) so then in returning to the user interface(Editing the Admin view) and scroll down to 'Create user fields, then there is 'Create user'. What has been written here, gets placed into the model. [00:12:07](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m07s) That is the Ajax method. In the Ajax input specific tasks are notated, the task name, and specific variables, and again the method name. Method Names may be different from the Task Names. Select what should be validated(In the 'Select a Filter' area), whether it should be a integer, float etc. and if there's no value(In the 'Default' area), get the default value. This is where the controllers information is set up. [00:12:39](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m39s) In this area (php Custom Method) may the custom script be done. Create user gets data and determines from what view it is, then validates whether this current login user has the permission to the Experts area. Then it converts the data because it's a Json set of datasets that is transferred and checks whether it's an array and does some other checks. It uses the Joomla's default filtering method so that it gets values that has been posted and validates if those values are actually there. The values are then transferred to the model. [00:11:05](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m05s) That is looking at it from a code perspective. Various methods are displayed in the model and some of them are protected and some of them are public. "Getcreateuserfields' are usually the ones that are called from the controller once the Ajax receives the verification level and is verified. Here is the 'createUser' class. [00:11:31](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m31s) Check this user. (It is custom script; Component Builder does not write this.) Return to the user interface, and scroll down to 'Create user fields where 'Create user' is found. What has been written here gets placed into the model. [00:12:07](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m07s) That is the Ajax method. In the Ajax input specific tasks are notated; the task name, specific variables, and the method name. Method Names may be different from the Task Names. Select what should be validated. (Select in the 'Select a Filter' area.) Select whether it should be a integer, float etc. If there's no value in the 'Default' area get the default value. This is where the controllers information is set up. [00:12:39](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m39s) In php Custom Method the custom script may be done. Create user gets data, determines from what view it is, and validates whether this current login user has the permission to the Experts area. Then it converts the data, because it's a Json set of datasets transferred, checks whether it's an array, and does some other checks.
### Global Helper Class ### Global Helper Class
[00:13:17](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m17s) [00:13:17](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m17s)
Here is that Global Helper class and methods being used.(See video) A number of Custom Methods may be seen which are available in that class. It has been added as freebies and should not necessarily always be used. If anyone can improve on those methods, please make a pull request and changes can be done. Once the required data had been collected(See video), and getting that same 'method', a 'Create User' is done. Here is the Global Helper class and methods being used. (See video.) A number of Custom Methods available in that class may be seen. It has been added as freebies and should not necessarily always be used. If anyone can improve on these methods, please make a pull request so that changes may be done. Once the required data had been collected, and the same 'method' received, a 'Create User' is done. (See video.) [00:13:55](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m55s) Get a result('$returned'). If it's not the correct result it should be dealt with accordingly. If it is the correct user it may be added to the user group. Create User does not do this. There is a user group setup in the component. [00:14:17](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m17s) The user group needs to be set into the correct user group. The return message will indicate if it has been an error or a success. The error message can be seen lower down. [00:14:45](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m45s)
[00:13:55](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m55s) Then get a result('$returned'), and if it's not the correct result it should be dealt with accordingly. If it is the correct user it may be added to the user group. That is something that Create User does not do. There is a user group setup in the component. [00:14:17](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m17s) The user group needs to be set into the correct user group. The return message will indicate if it has been an error or a success. Lower down can the error message be seen. [00:14:45](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m45s)
### Get User Field ### Get User Field
[00:14:53](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m53s) [00:14:53](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m53s)
Here is 'getUser' when the page loads initially. The ID and the data are collected, get packed into some HTML and gets send off. This is a PHP site where this 'Create user' is being done. [00:15:16](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15rm16s) Then there is a Ajax site in Javascript. As the page loads in the JavaScript, you would get 'User' with the 'User ID' and the User ID from the field and then the data gets loaded. It shows the data which is loaded and that data can be edited except over here(Username). [00:15:51](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m51s) Numbers can not be added in the username but this(see video) may be done and it will update it and will indicate that it is updated. If there is a error with the email already used it will also show an error. This is how JavaScript had been set up. Javascript has been added to the View file. Here is 'getUser', and the function is displayed. [00:16:24](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m24s) Usually two functions are used in this case, one that are on standby and eventually setting up the data into the view. This is how the call structure would usually look in index.php?option=your components name, and the task which must go to the Ajax controller. This 'getUser' is the task. [00:16:54](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m54s) Here can be stipulated in what format you would like the result set returned in. If the result set needs to be returned 'raw', which is sometimes the case, there is a 'raw' variable. [00:17:23](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m23s) The 'raw' variable may be set to true and it will give the results set just like that without braces around them, or a call back or anything. You will notice that when calls are made from JavaScript, it usually wants this call back to be added. If calls is made from other JavaScript libraries, you might just want the braces around it. But if it is wanted 'raw' which also is often the case, just add the variable 'raw' to the URL = true and then end up passing it back with 'json_encode'. When the page loads initially 'getUser' is there. The ID and the data are collected, packed into some HTML, and sent off. This is a PHP site where 'Create user' is done. [00:15:16](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15rm16s) There is an Ajax site in Javascript. As the page loads in the JavaScript, get 'User' with the 'User ID', the User ID from the field, and the data is loaded. It shows the data being loaded which can be edited, except here(Username). [00:15:51](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m51s) Numbers can not be added in the username but this may be done. (See video.) It will update it and indicate that it is updated. If there is an error with the email already used it will also show an error. This is how JavaScript is set up. Javascript has been added to the View file. Here 'getUser' and the function is displayed. [00:16:24](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m24s) Usually two functions are used in this case; one on standby and eventually setting up the data into the view. This is how the call structure would usually look in index.php?option=your components name, the task going to the Ajax controller. This 'getUser' is the task. [00:16:54](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m54s) Here can be stipulated in what format you would like the result set returned in. If the result set has to be returned 'raw', which is sometimes the case, there is a 'raw' variable. [00:17:23](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m23s) The 'raw' variable may be set to true; it will give the results set without braces around them, a call back, etc. When calls are made from JavaScript, it usually wants the call back to be added. If calls are made from other JavaScript libraries, you might want the braces around it. But if it is wanted 'raw' which also is the case, add the variable 'raw' to the URL = true and then end up passing it back with 'json_encode'.
NB.The format should remain 'json'. [00:17:56](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m56s) NB.The format should remain 'json'. [00:17:56](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m56s)
@ -58,8 +54,8 @@ Here is 'getUser' when the page loads initially. The ID and the data are collect
[00:18:01](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m01s) [00:18:01](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m01s)
Always use a token. Have the token on the page. This token is necessary to prevent cross site scripting . It is recommended to add the token to the page, through PHP. [00:18:28](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m28s) If work is done in a back end in the admin area, it is not necessary to add the token as it gets added to the page dynamically, since the JavaScript areas had been parsed . If it shows 'token' then 'token' needs to be there and the token gets added. Whereas in the front end, 'token' should be added manually. For various reasons it had not been automated in the front-end so that the variable[00:13:17](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m17s) name can be changed as well. [00:19:03](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m03s) Whereas now it is just token, its back end is more secure. Always add a token to the request and check whether the token is there, if it is not, that it would not make a request at all. That is simply how a user is created and how the user concept is integrated within this component. Always use a token. Have the token on the page. This token is necessary to prevent cross site scripting. It is recommended to add the token to the page through PHP. [00:18:28](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m28s) If work is done in a back end in the admin area, it is not necessary to add the token as it gets added to the page dynamically, since the JavaScript areas had been parsed. If it shows 'token' then 'token' has to be there and the token are added. Whereas in the front end, 'token' should be added manually. [00:13:17](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m17s) For various reasons it has not been automated in the front-end so that the variable name can be changed as well. [00:19:03](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m03s) Whereas now it is just token, its back end is more secure. Always add a token to the request and check whether the token is there. If it is not, it would not make a request at all. That is how a user is created and how the user concept is integrated within this component.
If you are not fully capable to do programming in JavaScript, jQuery or in PHP, this might not completely resolve your questions. This has not been meant to be a very user friendly component as such but rather a powerful tool to use. If you are not fully equipped to do programming in JavaScript, jQuery or in PHP, this might not completely resolve your questions. This has not been mean to be a user friendly component as such but a powerful tool to use instead.
[00:19:41](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m41s) At least this 'Class' had been added by which a user can be created. [00:20:20](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m20s) If my implementation needs some improvement, Component Builder may be forked on GitHub and copied to your repository and the necessary changes be done to it before pushing it back again. [00:20:47](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m47s) The place in Component Builder where this 'Class' is constructed, is within the compilers files. Compiler have quite a few files and a search need to be done. Go to Component Builder, go to Helper, and then use the compiler. Here is all its files. A search can be done in there for the function 'Create user'. [00:21:09](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m09s) As it is dynamically added, it is in that area where the adaption and the changes needs to be done. It can't be edited right in the script, it needs to be edited in the function where it is added. Just search those functions. [00:21:38](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m38s) That's how to create users and connect them to components. [00:19:41](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m41s) This 'Class' had been added by which a user can be created. [00:20:20](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m20s) If my implementation needs some improvement, Component Builder may be forked on GitHub and copied to your repository. The necessary changes can be done to it before pushing it back again. [00:20:47](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m47s) The place in Component Builder where this 'Class' is constructed is within the compiler's files. Compiler has quite a few files and a search has to be done. Go to Component Builder, to Helper, and use the compiler. Here is all of its files. A search can be done in there for the function 'Create user'. [00:21:09](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m09s) As it is dynamically added, it is in that area where the adaption and the changes must be done. It can't be edited right in the script, it must be edited in the function where it is added. Search those functions. [00:21:38](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m38s) That's how users are created and how they are connected to to components.