Updated 024 How to integrate the Create User Helper Method in your Components (markdown)
parent
53440562be
commit
be52c4a9ff
@ -3,51 +3,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)
|
||||||
(_Click on these time links to see Youtube video_)
|
(_Click on these time links to see Youtube video_)
|
||||||
|
|
||||||
What is the User Creation function? It is a part of code's helper function that is added to the Helper class.
|
What is the User Creation function? It is a part of the 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, 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'.
|
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 in 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 on 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 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.
|
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. It may be used 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'. 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)
|
There is an 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 an '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. 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.
|
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 an 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 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 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)
|
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 an 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 '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.
|
Within every component that makes use of Ajax, a model and a controller are 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 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.
|
It uses the Joomla's default filtering method so that it gets values that have 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 an integer, float, etc. If there's no value in the 'Default' area get the default value. This is where the controller's 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 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)
|
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 set up 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 success. The error message can be seen lower down. [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)
|
||||||
|
|
||||||
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'.
|
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 callback, 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)
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ When the page loads initially 'getUser' is there. The ID and the data are collec
|
|||||||
|
|
||||||
[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' 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.
|
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 is 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 into this component.
|
||||||
|
|
||||||
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.
|
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) 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.
|
[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 are 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 components.
|
Loading…
Reference in New Issue
Block a user