Ok, I know what I'm about to say is going to be super vague, but hear me out:
I want to use flash messages because I like the idea of them, but they don't seem to always work for me.
Here is my workflow:
User creates a group on page A
I send an email notification to
members of the new group
I set the flash message "Success!"
I redirect the user to the newly created group and display the "Success!" flash message.
The problem is after I redirect the user, the flash messages are no longer in the $_SESSION. To make this even more strange, if I take out the step where I send email notifications, it DOES work. WTF?
Has anyone else experienced similar issues with flash messages? Does anyone have any insight into why sending the email would affect the flash messages?
I think at this point I'm just going to stick with setState and manually remove it after displaying them.
Now You can set a property autoUpdateFlash of CWebUser component to false. In this case flash message will be removed only after usage.
How is the email being sent? I know using the Yii Mail extension (a swiftmailer wrapper I think) in "debug" mode uses the setFlash method, so perhaps that's wiping out the array somehow...?
The "flash" variables are updated by the init() method of CWebUser, so if there is an extra call to CWebUser it's possible that's what is clearing out the flash variables.
Considering that you set the flash AFTER the email though, I'm not sure how that would happen. My only other guess besides the "debug mode" thing (not a problem if you are just using the PHP mail methods though) is that sending mail is triggering an extra redirect somewhere.
If you have a PHP debugger like XDebug installed I would set a breakpoint in the getFlash and setFlash code and get a look at what is happening that way.
Good luck!
Related
I've implemented the PHP library against a Sentry onpremise installation into a project which is working great, I have no problems with the functionality when its set up to work.
What I'd like to do is determine when for any reason the actual sentry recording fails, however struggling to find where in the application flow Sentry returns something that can be utilised to determine 'recording success'.
I've forced a failure by changing the DSN address being used in the Raven_Client construct to an invalid URL and can confirm events are NOT being recorded - which is expected.
The Sentry Raven_Client exposes a method getLastEventID() which seems to contain an ID at the creation of the event itself, and not upon successful submission to the server (which I expected it to be, and had done a check on to display my error page).
There is also a getLastError() method, which is null at the point my application (CodeIgniter) has entered the My_Exceptions::show_exception() method to display an error page to the client.
The SentryID is populated, and the error is null, and I'm not sure what else there is available to check on to know that the error report actually failed to be recorded.
The reason I want to do this is so that I can show a different view to the user (that doesn't say 'Support have been notified'; as they haven't) and also the functionality to check that $sentryEventId and show a custom feedback form obviously needs to be hidden as the sentryEventId is invalid and the feedback wont go anywhere.
If you are on version 1.10.0 of the Sentry PHP SDK and are not using any async way of sending the events (the default) the getLastEventID() will be null if the send action fails.
See also the PR that introduced this change.
Help! I've just set up a page using the simpleform plugin for an easy email enquiry form.
[url]http://bath-choral-society.org.uk/index.php?page=tickets-form[/url]
I've checked the stylesheet, the template, and the tags I've used (see below)
{simpleform sendto='myemail#email.com' subject='Tickets Enquiry'}
I've changed the email that it's trying to send to, I've changed the subject, I've taken out the captcha bit that I was trying to use initially. Whatever I do, I still get the error message. What is going on??? Have I done something completely stupid?
Thanks for any help...
Can you receive a CMSMailer Test message?
Any errors reported in the Admin log or PHP Error log?
I haven't used that plugin before, but will test it if it helps.
Chris
It is most likely to be that whoever set-up the site initially has not correctly set-up CMSMailer. You just need to put in the correct settings to be able to send emails. The smtp mail settings usually work fine, once all the correct settings and password are used.
The error log in cPanel is the right place to look - no errors is good news.
I've read an article from the Symfony2 Cookbook, called "How to work with emails during development", specifically "Viewing from the web debug toolbar". It said that if an email is send and request than redirected, you can still view sent email with 'intercept_redirect' option. However, there is no information regarding how to view an email that was sent with AJAX request...
I believe that such function was implemented in 2.6, according to this article. But most of my project using 2.3, and currently I'm using dirty things like dumping content in response to view it on Network tab in browser toolbar, but that's quite bad for testing purposes.
I've read solutions like this one, but there is still no info about emails.
Maybe anyone had a similar issue? Thanks in advance.
The only thing you actually need is having access to debug tokens for your AJAX requests, so you could then open up the profiler and look at the mailer stats. The easiest way to do this would be:
$(document).ajaxComplete(function(event, XMLHttpRequest, ajaxOption) {
if (XMLHttpRequest.getResponseHeader('x-debug-token-link')) {
// This is the link to debug panel
console.log(XMLHttpRequest.getResponseHeader('x-debug-token-link'));
}
});
This would log all the profiler links to the console. So, after an XMLHttpRequest has completed you could open them up and see whether your emails were sent.
I'm programming a calendar website. The reminder message should be sent using kik.
Therefore I need to send a message even if the page is not actually called.
Is there a possibility to do this, for example using a timer that is set when the date/event is
put into the calendar from the user
thanks for your help
This is not possible. The Kik API is structured in a way that messages can only be sent with the user's explicit permission.
Push notifications are an alternative for your kind of use-case. Check out the documentation here: http://dev.kik.com/docs/#push
What is PHP action? Is there anything called as PHP action? I tried to google it and look up different web forums but was not able to find anything related to this. A recruiter had sent me an email where he wanted someone with skills/experience in "PHP action". Just curious.
If it stood on its own like that, my guess is the recruiter doesn't know what he's talking about. Maybe it was a copy+pasting error from "Actionscript" or something.
"PHP Action" is not a defined term. At least not one I have ever heard of.
My tendency would be to respond anyway, and then sort the details out later when getting interviewed by the actual employer.
Action is a term used throughout the Symfony Framework 1.x, perhaps he was referring to that. They are basically page controllers. Few examples:
// apps/myApp/modules/myModule/actions/actions.class.php
public function executeIndex() {}
public function executeResult() {}
he Action attribute is crucial. It means, "Where do you want the form sent?". If you miss it out, your form won't get sent anywhere. You can send the form data to another PHP script, the same PHP script, an email address, a CGI script, or any other form of script.
In PHP, a popular technique is to send the script to the same page that the form is on – send it to itself, in other words. We'll use that technique first, but you'll see both techniques in action.
So we're going to be sending the form data to exactly the same page as the one we have loaded – to itself. We'll put some PHP on the page to handle the form data. But for now, save your work again and then click your submit button. You won't see anything different, but you shouldn't see any error message either!
Once your script has an Action attribute set, you can then Submit it. Which we'll see in the next part.