CraigT543 / EasyBlue

Modifications for Easy!Appointments
21 stars 23 forks source link

Begin Utilization of SMS Reminders #26

Open jacobandrews96 opened 6 years ago

jacobandrews96 commented 6 years ago

Hi, I love the application.

I was wondering how I could get the SMS reminders to work? Right now they do not send. Is there an application I have to purchase or code mods that need to be made for the messages and reminders to go out through email and through texting?

Thank you so much!

CraigT543 commented 6 years ago

It requires access to cron tab in Apache or similar program. I explain a bit about it here: https://github.com/CraigT543/EasyBlue/issues/25

jacobandrews96 commented 6 years ago

Thanks! Also, I saw that on your website a user can log in as a retunring booker. Now, if I do not use the wordpress plugin, am I able to add this function too?

CraigT543 commented 6 years ago

I built that with the Theme My Login plugin (TML). So that is different. If I had it to do again I would use Gravity Forms login add on. I use Gravity to generate my forms. I used to use CF7 until there was an update and a lot the other plugin's I was using to make CF7 do the magic for me did not work with CF7 anymore (it took over a month for them to update). So I switched to Gravity, which is a paid plug in. I like it a lot and it is worth the price. So, if you are going to do wordpress and want to do a login that has a custom registration process TML is the most popular and it is free. Gravity is paid but more user friendly and the forms development engine is really quite good.

The wordpress plugin for EA is good but it does not hook into wordpress thus letting you use the wordpress functions to grab user ID user email and so on from the word press database. What I have done with my method is to fully hook in. I am able to use the wordpress functions in my code, this allows me to auto fill the username and email into EA if the client is logged in. That may not be a big deal for some. But for me everything is linked to that email address of my clients. I need it to auto fill correctly every time. I also grab the wordpress ID and it is loaded into EA. That way they work together. Also with the hooks I can use other plugins like "Insert PHP" to make a page where clients can see all their upcoming appointments and cancel them or edit them. So that is what I was wanting to do when I edited the EA code.

--Craig

jacobandrews96 commented 6 years ago

Okay sounds good thank you. I am really quite confused on the cron tab. I'm going to see if there is another way to send texts without using cron. Thanks!

CraigT543 commented 6 years ago

Cron is an issue. Every server has a slightly different address for it and then there are different ways of reaching php. It does not require cron, it the script can be launched by any timer. Have you found chron on your server? Have you opened it up. Often you will see other scripts running in there and you can discern from there how it is reaching php.

jacobandrews96 commented 6 years ago

I am not sure where to look honestly? I use blue host as my host, would that be considered my server?

CraigT543 commented 6 years ago

Yes, you may want to contact blue host and ask about access to cron tab. Let them know the address of the script you are hoping to launch. They may be able to help you out with that.

jacobandrews96 commented 6 years ago

Okay, thank you! Sorry to ask so many questions! Great application mods on your part!

jacobandrews96 commented 6 years ago

One quick question, is it possible to change the time that the text notification is sent to 1 or 2 hours before opposed to days? How would I go about doing that? Could I just write 1/24?

CraigT543 commented 6 years ago

It could be done. I have set it up for days. But you could tweak the code to allow for hours instead. I do not think that would be too difficult.

jacobandrews96 commented 6 years ago

Okay thanks!

jacobandrews96 commented 6 years ago

So, if the cron path is correct from the reminders.php file, will it send the texts?

CraigT543 commented 6 years ago

Short answer yes.

Ok long answer, in my file "/application/controllers/cli/HowToUseCLI.txt" I have an example of how to add a line into Cron. The line will look something like this:

30 7 * root /usr/local/bin/php56 /volume1/web/PathToE!A/index.php cli/reminders

The first two numbers (30 7) indicate that the script will launch at 7:30 AM. The 'root' indicates the level of permission to do the task and it is likely that root will be the case for you. The next path is the path to php on your server and in my case the path is /usr/local/bin/php56. But it is not that on all servers. For some, you just need 'php' and no path. This is not uncommon and it may be the case on your server. The server interprets it and knows the path. Mine requires php56 and the path to it because I have php5.6 and php 7.0 running at the same time on my server so I have to differentiate. And then the final path, of course is to EA and then the path to the reminders script. So the format that I am describing is common but the paths are unique. And then there is the use of a tab vs a space when separating the paths. Some require a space and others require a tab. Mine requires a tab. If you open up cron you will see how it is done on your server and you just need to keep with that convention.

jacobandrews96 commented 6 years ago
screen shot 2017-11-15 at 2 42 56 pm

I can't thank you enough for the help, im slowly but surely getting there! Does this mean i don't have either php installed on my server?

jacobandrews96 commented 6 years ago

Found through "[/usr/local/bin]# ls" through terminal when I ssh'd into my host

CraigT543 commented 6 years ago

No you have php running it is just not there in that file. EA would not work without it. Try something like this: 30 7 * php /volume1/web/PathToE!A/index.php cli/reminders

It often will work.

jacobandrews96 commented 6 years ago

Okay, so I see that makes snese- I got to the cron tab through terminal now and inputted this- I included cpanel in the path since it was listed above.. did not do that for jail shell though

screen shot 2017-11-15 at 4 15 07 pm
jacobandrews96 commented 6 years ago

Is there a certain way I should name the cron job?

jacobandrews96 commented 6 years ago

Never mind, I understand why that doesn't work! I think I may have gotten it, thanks!

jacobandrews96 commented 6 years ago

Is there a way to test if it works or not since I'm already live with clients currently?

CraigT543 commented 6 years ago

What you can do is launch the script through command line usually that means you go into the terminal and launch it with something like this:

php /volume1/web/PathToE!A/index.php cli/waitinglist

In cron try something like this: 30 7 php /volume1/web/public_html/appointment/index.php cli/reminders 30 21 php /volume1/web/public_html/appointment/index.php google/sync3

Are you sure that your address starts with volume1? Not all do. And not all have the web root folder as web so just be sure that is correct.

Look at what is in cron now. Post it if it is safe, and I may be able to discern what to do from that.

jacobandrews96 commented 6 years ago
screen shot 2017-11-15 at 4 56 21 pm

only the one's I've just added

jacobandrews96 commented 6 years ago
screen shot 2017-11-15 at 5 06 14 pm

Would this help?

jacobandrews96 commented 6 years ago

my username is blanked out on the fourth line to the bottom

CraigT543 commented 6 years ago

So it looks like you are not using the proper address to your easy appoitments. I found this: https://my.bluehost.com/hosting/help/168

From this it looks like the line would be: php /home/username/public_html/cron.php 30 7 php /home/username/public_html/appointment/index.php cli/reminders 30 21 php /home/username/public_html/appointment/index.php google/sync3

Change username to your username and that should hit it. What you can do is, make an appointment within the time range, just set the cron time to 5 minutes from now and see if the reminder sends. That should do it.

jacobandrews96 commented 6 years ago

Thank you! I even contacted bluehost a few times and they told me the paths were correct earlier- thanks for the correct info! I'll let you know how it goes! Fingers crossed!

screen shot 2017-11-15 at 9 45 30 pm
CraigT543 commented 6 years ago

That looks good. you can leave out the line that is /home2/username/public_html/cron.php I forgot to delete that from my example.

jacobandrews96 commented 6 years ago

hmm, no dice- I took that line out. I'm going to sleep on it and trouble shoot tomorrow. Thank you so much for your help, I really appreciate the time you've spent helping me!

jacobandrews96 commented 6 years ago

So, I set it up to email me if successful.. the google/sync3 was! The cli/reminders hit an error

Any thoughts? Would it be that it was not able to format or generate the phone number? When I was testing, i did not receive a text

Line 45:

screen shot 2017-11-16 at 1 15 52 pm

Error message received via email: A PHP Error was encountered

Severity: Notice Message: Undefined variable: result Filename: /home2/username/public_html/appointment/application/controllers/cli/Reminders.php Line Number: 45


A PHP Error was encountered

Severity: Notice Message: Undefined variable: result Filename: /home2/username/public_html/appointment/application/controllers/cli/Reminders.php Line Number: 45 Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

User-Agent: Easy!Appointments
Date: Thu, 16 Nov 2017 00:10:02 -0500
From: "The Barber Shock" <shockdabarber@gmail.com>
Return-Path: <shockdabarber@gmail.com>
Reply-To: <shockdabarber@gmail.com>
X-Sender: shockdabarber@gmail.com
X-Mailer: Easy!Appointments
X-Priority: 3 (Normal)
Message-ID: <5a0d1daa6b58d@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
=?UTF-8?Q?One=20more=20day=20until=20y?==?UTF-8?Q?our=20app?= =?UTF-8?Q?ointment.?=
The Barber Shock
REMINDER: Your appointment with Michael Shockley is on Friday, November 17,
2017, 10:00 am

If you have had a good experience, let others know! Please review me at: https://www.google.com/search?q=the+barber+shock&amp;oq=the+barber+shock&amp;aqs=chrome..69i57j69i60l2.3332j0j7&amp;sourceid=chrome&amp;ie=UTF-8

To edit, reschedule, or cancel your appointment please click the following link: http://www.thebarbershock.com/appointment/index.php/appointments/index/ba586561adbf49decbfc091d5952f4e7

A PHP Error was encountered

Severity: Notice Message: Undefined variable: result Filename: /home2/username/public_html/appointment/application/controllers/cli/Reminders.php Line Number: 45 Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

User-Agent: Easy!Appointments
Date: Thu, 16 Nov 2017 00:10:02 -0500
From: "The Barber Shock" <shockdabarber@gmail.com>
Return-Path: <shockdabarber@gmail.com>
Reply-To: <shockdabarber@gmail.com>
X-Sender: shockdabarber@gmail.com
X-Mailer: Easy!Appointments
X-Priority: 3 (Normal)
Message-ID: <5a0d1daa92814@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
=?UTF-8?Q?One=20more=20day=20until=20y?==?UTF-8?Q?our=20app?= =?UTF-8?Q?ointment.?=
The Barber Shock
REMINDER: Your appointment with Michael Shockley is on Friday, November 17,
2017, 3:30 pm

If you have had a good experience, let others know! Please review me at: https://www.google.com/search?q=the+barber+shock&amp;oq=the+barber+shock&amp;aqs=chrome..69i57j69i60l2.3332j0j7&amp;sourceid=chrome&amp;ie=UTF-8

To edit, reschedule, or cancel your appointment please click the following link: http://www.thebarbershock.com/appointment/index.php/appointments/index/

A PHP Error was encountered

Severity: Notice Message: Undefined variable: result Filename: /home2/username/public_html/appointment/application/controllers/cli/Reminders.php Line Number: 45 Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

User-Agent: Easy!Appointments
Date: Thu, 16 Nov 2017 00:10:02 -0500
From: "The Barber Shock" <shockdabarber@gmail.com>
Return-Path: <shockdabarber@gmail.com>
Reply-To: <shockdabarber@gmail.com>
X-Sender: shockdabarber@gmail.com
X-Mailer: Easy!Appointments
X-Priority: 3 (Normal)
Message-ID: <5a0d1daab36fc@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
=?UTF-8?Q?One=20more=20day=20until=20y?==?UTF-8?Q?our=20app?= =?UTF-8?Q?ointment.?=
The Barber Shock
REMINDER: Your appointment with Michael Shockley is on Friday, November 17,
2017, 12:30 pm

If you have had a good experience, let others know! Please review me at: https://www.google.com/search?q=the+barber+shock&amp;oq=the+barber+shock&amp;aqs=chrome..69i57j69i60l2.3332j0j7&amp;sourceid=chrome&amp;ie=UTF-8

To edit, reschedule, or cancel your appointment please click the following link: http://www.thebarbershock.com/appointment/index.php/appointments/index/cbf645845421b9c7470b5dd78507f5d2

jacobandrews96 commented 6 years ago

Weird thing is that emails send fine when people book an appointment. Both the provider and the customer get one automatically

CraigT543 commented 6 years ago

Are you using the latest build? Your reminders file does not look right. It should look like this:

https://github.com/CraigT543/EasyBlue/blob/master/easyblue_1.2.0/easyblue_1.2.0/application/controllers/cli/Reminders.php

So it line 45 in your file is found about 100 lines down in this.

jacobandrews96 commented 6 years ago

I am not using the latest build. I am using the previous build before your latest. Would I be able to configure a way to get this one working? I played around with the new one, love it, just wasn't sure the best way to update it without losing the appointments so I continued the current one. I also like how this one sends an email appointment right away, in the newest one it didn't and I have trouble configuring.

Would it be possible to get the reminders.php working from the old one? Or, would it best to upgrade, configure then get it working from the newest build?

CraigT543 commented 6 years ago

I would use the newest one. The older one has lots of little glitches that are fixed in the new one.

jacobandrews96 commented 6 years ago

I am using the version before still - would that be the case? Is there a way to work it with the one before your newest build?

Could I just switch out these files or would I have to update the whole system?

On Thu, Nov 16, 2017 at 19:31 Craig Tucker notifications@github.com wrote:

Are you using the latest build? Your reminders file does not look right. It should look like this:

https://github.com/CraigT543/EasyBlue/blob/master/easyblue_1.2.0/easyblue_1.2.0/application/controllers/cli/Reminders.php

So it line 45 in your file is found about 100 lines down in this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/issues/26#issuecomment-345108010, or mute the thread https://github.com/notifications/unsubscribe-auth/AXxC8T-bPcsZjPbokCTleQIqT6o_lMK_ks5s3NPVgaJpZM4QZ9O7 .

CraigT543 commented 6 years ago

You would need to run the update routine. It is pretty simple. I think you will see it is a significant improvement over the other builds. Bullmoose added some very nice features to the settings page and I built on what he did. Also, the mail system was improved so that everything is using the phpMailer system and I have dumped php Mail. It looks like that is an issue for you too. The update procedure is here:

https://github.com/alextselegidis/easyappointments/blob/master/doc/update-guide.md

CraigT543 commented 6 years ago

I just noticed that I had forgotten to add the phpMailer changes. I will update that now.

CraigT543 commented 6 years ago

Ok, I have added the phpMailer changes. That should take care of your email problem. Give it a shot. I see that you made some modifications to the text in the reminder and waiting list file. Rather than do this directly to the code, now you will make those changes in the language file:

EA/application/language/english/translations_lang.php

I think the notes are sufficient to indicate where you will be changing things there.

Also it is a lot easier to modify the colors now to match your site. So look at what is done there. That was another bullmoose idea. It is really good. Bullmoose also added formatting to the reminders and waiting list so it looks a little more polished. I have added some things that you will not need like a consent page. You can turn that off in settings. Take a good look there because there are a lot of improvements on that page.

jacobandrews96 commented 6 years ago

Wonderful, so now if I download the one off github it is updated?

CraigT543 commented 6 years ago

Yes, it should be good to go.