Updated 026 How to setup a store message method along side the email helper class (markdown)

Amigo 2019-07-05 08:33:13 +02:00
parent 59c891e27a
commit 34e986cc71
1 changed files with 5 additions and 3 deletions

@ -11,8 +11,10 @@ At the bottom of this class in the 'Send' method, [00:01:21](https://www.youtube
### Adding Code To Admin Helper Area
Open a component(Learning manager) and go to Libs & Helpers. Scroll down and 'Add PHP(admin_helper)' may be seen and in there is a function called 'storemessage', where the component may be editted. [00:02:47](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m47s) This 'Storemessage' has a signature that exists of values that is transferred to the method.<<<<<<<<<<<<<<<<<<<<<<
Open a component(Learning manager) and go to Libs & Helpers. Scroll down and 'Add PHP(admin_helper)' may be seen and in there is a function called 'storemessage', where the component may be editted. [00:02:47](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m47s) This 'Storemessage' has a signature that exists of values that is transferred to the method.
In the [00:03:19](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m19s) email helper class, you will see that it also has a signature. Wherever it gives this '=null' with a value, that is the default value. If you do not add a value for this position, there is one, two, three, four, fifth, positions, then it will default it to 0, if we do not add this, it will default to null. From there all the way to the end all of those values have the [00:03:51](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m51s) null value. In reality you only need to add the first four values. Those values are all used in this method(see video). If you want to understand exactly how these value should look, look inside of the method, read through the method, and you will see.
In the Email Helper Class it also has a signature.[00:03:19](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m19s) Wherever it gives this '=null' with a value, that is the default value. If a value is not added to this position, there is one, two, three, four, five, positions, then it will default it to '=null'.[00:03:51](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m51s) From there all the values receives the value '=null' . It is only nessesary to add the first four values. Those values are all used in this method(see video). [00:04:17](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m17s) This script "if(method_exists('Jobtracking Helper','storeMessage'))" asks whether the method has been created. If not, it simply skips it and returns the value of '$sendmail'. [00:04:52](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m52s)If it have been created, it will pass these variables that correspond to the signature. In that method that is in the Helper Class (PHP), the necessary checks and balances must be done, since the email address is known, a search may be done with the 'getVar' in the User Class. The recipient must equal 'email', and returns the 'id'. [00:05:09](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m09s) That how the 'getVar' operates. Then having the user ID, the number can be verified and be set to the message as 'User'. That is then set as the Email.<<<<<<<<<<<<<<<<<<<<<<<<
Making a long story short, [00:04:17](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m17s) we end up here at this little script. Basically ask whether you created the method or not. If you didn't it simple skips it and returns the value of send mail. If it sees that you have created it, it'll pass these variables that correspond to the signature. And then inside of that method that is in your helper class, that is how this method, you need to do the necessary checks and balances, and discovering for example since you've got the email address. [00:04:52](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m52s) You can search with the getVar in the user class. It must equal email, recipient equal email, and then returns to us the id. So [00:05:09](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m09s) That is basically how the getVar works. Then when we have the user id, we can make sure it's the number and we set it to our message as user. We set it as the email. Now we can store the message in whatever table or do whatever we want to do beyond the normal. Even if you want to do other things except [00:05:38](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m38s) storing the message. This is the method inside of which you can do it. Storemessage is the method inside which you can do some more custom scripting on top of your email integration. That's just quickly giving a little bit more depth on that specific aspect of using the email class in your component.
Now we can store the message in whatever table or do whatever we want to do beyond the normal. Even if you want to do other things except [00:05:38](https://www.youtube.com/watch?v=peVNLsAncGY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m38s) storing the message. This is the method inside of which you can do it. Storemessage is the method inside which you can do some more custom scripting on top of your email integration. That's just quickly giving a little bit more depth on that specific aspect of using the email class in your component.