-
-
Notifications
You must be signed in to change notification settings - Fork 178
024 How to integrate the Create User Helper Method in your Components
Hi I would like to give you a quick tutorial on illustration on how to use Asian method In your component What is the user Creation function It is basically a part of code helper function actually The gets added to the helper class How does if you don't know where the helper classes that we could to show you To your Pasta tree Find basically your Gmail install Happiness traitor Now there is a helper class for the front end of every component as well as for the back end Looking in a backend We go to component Extra Database Helpers And it's basically that file there What is the helper Class to open it See that it's the abstract extra database helper Now that help with class gets included Into your component on every page so if you to open the main back in file with that one It's loaded by July 1st you'll see that it actually in A profile in every page So that means everything inside of that Class is available to you everywhere in your component When we cook when we actually then go back to the hour Interface Are we go to components Extra Database You see that there is a lips or actually stand for library and helpers and We have to switch Tech yes ad create user helper method Set to yes That is the The switch that you need to trap So that component build and knows that you actually want the help of class Create users Added to the helper class of your front and backend of your Aishwarya Rai I'm gonna close out here Back to the code And then Simple search 4 I want Goku uses That there is Create user See this is a public static function So you would basically call it Then colon colon Under the name of the function right Create user And you see that it said to new Now New has in it A few variables is basically an array So you can go through this class and you'd see that it has a password one or just password the password to The name Gmail And Create the user That's what this class does so it calls in the Joomla Component uses Schools in its registration And then it basically uses that model to create a user so that's what that switch does it have Fastest class to your component you can then use it in your component it doesn't Set everything else in place you still required to do as a developer to add to correct code And I'm using it View Court experts Option for someone to create a user now let me first demonstrate how it works Go to extra data base and click on experts Let's click on new There is a Expert Which you can select Users within a specific group I will also explain some of that more later There is this button create user Click on it it basically has a pop-up wearing you enter a user name Who's gonna say Testing 123 What is the username The password There we go So everything is testing And you guys click create it basically has this nice effect Busy creating at Setting it up sending out the email doing all of that for you And once it's done It lets you know who's it was created successfully The login details was emailed to the user And then it's here ready to select You can select testing 123 that you just created from the user list In the above field simply click on the blue user icon Click here Type in that testing Search And there is the user created 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 And then changing it to 123 and say save the update Ronaldo My new application doesn't wanna allow you to use Wendy's We have this integrated user now that is connected to an expert And if you were to click there again You can still selected ok but once you select it once you can't create a new expert And select that user again So it's basically want profile connecting to one user To set up the next 4 So that's the feature I am 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 About yourself Ok let me just get out of here Example of be here I wrote this job tracking extension And let's say we want to create a new job order Can say whether it's a new client If it's an existing Simply selected from this list If it's new I click here I can enter all the details of the user and when I click save Create the user Stores the data in the user table not in the job or the table delete all these these So did the job on a table that never stores any user values And so that's another way that I have implemented so if we were to close this out And where to open a client The new one Beauty basically it's the same values And Everything is the same So that's another way that we integrated Integration Different ways to 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 And then simply Make It Happen that way My person I prefer the Ajax Way much more It's it's just seems to me So let me illustrate some of leopard show you some of the code that I used Ok so we back in The Experts View As I've done before I previously another tutorials explained how to make use of the 8 Ajax Within Component Builder Love you that like to understand what's going on let me give you a quick At the code level Within every component that makes use of Ajax A model and a controller is created Controlling is named Ajax Jason dot PHP and the module is name Find Ajax Ok let me open the model And also let me open The controller As you can see the controller basic fire is off The register tasks within the construct And then it adds the tasks Into a switch And tries to run the task basically Also an ink The model Get the module Ajax And then runs the method that basically corresponds to the task And so It runs Uses the Gmail as default Filtering If it's in the way that it gets values that are being posted And then value dates that does values actually are there Then send the values over to the model Now that's looking at it from a code side so if you look at the model Simply shows you Various Some of them are protected And some of them are public and those are usually the ones That I get calls from the controller once the Ajax gets the Verification level tennis Verified Toyota create user class Basically We first check Whether this user now this is custom script I am in this I wrote a custom component build it does not brightness Simply when you go back to the user interface You see that Scroll down here A user fields And then there's great user Just right here And that basically gets placed So that's the Ajax method I simply in that Ajax input I annotate the specific tasks The task name And specific variables And again did the method name Different method names from task names What should be validated whether it's a integer float or whatever And if there's no value What is the value by Default So this is where you set up there basically the controllers information And then hear your customised is write your script so basically Grade user gets data since from what view is it Invalidates with this Information Two actually The Experts area Then it Convert the data because it's a Jason said of datasets that I'm sending across X-ray So you can see I'm still here I'm using that Mobile helper Class and methods Your number of customers it's obviously that That is available in that class to go through it we just added in there as freebies and Always see the Need of them but I'm using them often And even if you have with Improvements on those efforts please make a pull request and we'll make those changes Then you over here Sure that we've got enough data on the right data We basically get that same method and we need to create user Get result And if it's not Bridge Resort we deal with it Morning Lee And if it is the correct result we create Add the user to the user group That's something that the user does not Does you grade user does not do So we Then have a user group setup And Basically in the component And we Set into the correct User Group This is a return message If it's an error Always hits Success So done here is the error message So if it's if it's successful this is what we do if it's unsuccessful this is what we do And so that's just a quick look I mean obviously we can pause this video and Look at her Done And then here is to get the user when the page loads initially The ID get the data Accident to some And send it off So This is the PHP side I'll be asleep We we do this create user and then there is a a Siderite So Script when page loads Would you get user with the user ID We get the user ID from the field And then it loads that data that you saw If you if you looked Basically shows you that is the data and loads And that data can be edited Except over here Cannot add numbers in the username but you can Goodwill updated I will say that is updated Obviously if there is a Mirror with the email already used or something it also give you an error This is all part of how we basically have setup JavaScript The Weeknd scroll down to I've just added to Javascript to the new file And here is get user the server side and there is the the function I have two functions usually one that sort of deals with Waiting and then eventually setting up the data into the The View And here's one making the call so this is how you call structure with usually look Index HP Question mark option = your components name And the task which Must go to the Ajax controller And then this is the task And you then here can stipulate what format you would like the result set returned them View What is the result set returned the role which in sometime sometimes is the case There is if you look here There is a roar Variable You can just set the rule variable to Then it will give you the results set Like that without Braces around them Or a call back You see when you make calls from JavaScript Did you slee Monsters call back to be added If you make calls from other JavaScript libraries who might just want the braces around it But if you want it raw which also is often the case Add the variable draw to the URL = true End up passing it back to you with this Arsenal heads up on Ajax function Format must a Jason Important Always use a token Have the token on the page this token is necessary To prevent cross site scripting of course I usually add the dog into the page Through the JavaScript PHP The place down here I just remembered remembered Every working in a backend The back in the admin area Capitec and it's gets added to the page dynamically Since we Basically passed the JavaScript Areas And we see token we actually know token is to be there and we had to tell him for you Where is the front and you must actually literally at the poker There was just too many Not to do the Automation in the front end Games to the variable name as well Do something of your choice Where is now it's just joking it's back in it's more secure You need to always add a token To the request Check whether token is there if it's not that it wouldn't make a request that all Ok so I was looking at another function there Ok so that's simply how we create a user And integrate the use of concept within this component I hope that was helpful I realise if you not that fluent in programming in JavaScript Orange on a date with jQuery As well as in PHP Is my not fully resolved your questions Like I said where the beginning of these tutorials I wasn't planning on making a component Very easy to use Component that is very powerful to use I'm leaving it up to you to decide how to implement This user integration The most powerful way of doing it At least we are adding the the class with which you can create the user And again even there you can go look at that class If you feel my implementation is too little Provement Can I shoot me a mail or you could For this component Builder on GitHub Pull down to yarn repository Make the changes push it back And Inside Of component builder where this class is constructed Obviously Within Compiler is files that the compiler Has View files and you need to do to a search Go to component Builder The helper Use the compiler And here is always files Research in here 4 Ocean Create user you could How to search for that I'm sure you're fine it In that area where you need to make the station and it changes because it's daytime It is not Can be edited like right Script to be added in the function where we had it Just go search those functions Thank you for watching That's how you create users and connect them to your components Much more to say but I'm afraid this will get way too long like most of my tutorials get to I want to keep it this this way and trying to make it shorter hope you enjoyed that
- Home
- Beta Testing
- Custom Code
- PHP Settings
- Demo Component
-
Tutorials
- Hello World JCB
- Intro JCB Guide
- JCB Installation Steps
- Planning Components
- Field Type Overview
- Basic Fields Creation
- Admin View Management
- Advanced Field Usage
- Admin Component Integration
- Component Setting Customization
- Scripting Components
- Component FTP Options
- Dynamic Get Method
- Site View DynamicGet
- Site View Templates
- Template Setup Guide
- Layout Configuration Steps
- Custom Admin Management
- Adding Site Views
- Custom Admin Integration
- MySQL Demo Tweaking
- Global JCB Settings
- Custom Time Field
- User Helper Integration
- Email Helper Usage
- Message Store Email
- List View Unescape
- Export Import Customization
- Overwrite Custom Fields
- List Field Filtering
- Automatic Code Import
- Manual Code Implementation
- Component Export Import
- Custom Admin Buttons
- Translation Management
- Site View Permissions
- Component SQL Updates
- Site Edit Configuration
- JCB Backup System
- Helper Structure Integration
- JCB v2.5 Upgrade
- Tab Setup Guide
- JCB v2.6 Release
- Extended HelloWorld
- Field Rule Validation
- Community Snippets Intro
- Snippet Forking Tutorial
- Pull Request Snippets
- Library Manager Area
- Excel-based Translation
- Dynamic Router Details
- Database Auto Updates
- Subform Quick Demo
- VDM Package Import
- Dynamic File Inclusion
- File Field Upload
- Drag-n-Drop Upload
- Quick HelloWorld JCB
- Non-database Fields
- Dashboard Customization
- Menu Prefix Toggle
- Community JCB Packages
- Collaborative JCB Workflow
- JCB Package Install
- JCB JAB18 Event
- Convenient New Fields
- Component Language Strings
- Library Functionality Anticipation
- Join Field Relations
- License Template Change
- Code Reusability
- Local Dev Environment
- Extended Field Types
- Joomla Custom Fields
- Custom Field Expansion
- Site View Listing
- Run Expansion Method
- Form Site View
- Field URL Update
- Additional Helper Methods
- Field Validation Rules
- New Placeholder Feature
- Component Config Params
- Per-field Default Values