Drupal variable messages empty on frontpage - php

I've a drupal site with some plugins, everything is running fine, but i don't know why, in my frontpage this code isn't working:
if($is_front){
if ($messages):
print $messages;
endif;
}
If i try to do a var_dump of messages, it results in empty string.
The same code, on other pages (not front) is working.
This variable is used when showing sys/drupal messages (ex: after user registration), if i set the user registration to show a page different than the frontpage, the message is showed, otherwise it's not.
Thanks

You obviously know that $messages is only populated when you submit a form and validation fails or something similar. I wonder if perhaps, that variable is being cleared upon redirection to the homepage and thus not showing up???
I assume you have a form or something on the homepage which you are submitting?
Cheers,
Alex

Related

Contact-Form 7 reloads page instead of doing AJAX

I am having my first go at converting a HTML template to a custom WP theme, so far everything is working out quite well and it's a very nice learning process..
I am using Advanced Custom Fields with Advanced Custom Fields: Contact Form 7 plugin. And set it to display in the following way:
<?php echo do_shortcode( '[contact-form-7 id="135" title="contactform"]' ); ?>
Everything is displaying the way it should, however when I press submit (if filled) it seems to reload the page while adding the following to the URL:
/?_wpcf7=135&_wpcf7_version=5.1.6&_wpcf7_locale=da_DK&_wpcf7_unit_tag=wpcf7-f135-o1&_wpcf7_container_post=0&your-name&your-email&your-phone
If it's not filled it just reloads the page.
This indicates that something doesn't work the way it should, since CF7 normally comes with error (if not filled) or a success message (if filled).
Hope someone can figure this one out.
UPDATE
I managed to it from reloading, the reason was that the php statement was wrapped in
<form></form>
However now it doesn't submit, I am only left with a loading icon which turns around. I looked into what the error might be and got the following:
Error
UPDATE - PROBLEM IS MAYBE FIXED
So after looking up solutions I found out that having permalinks settings on postname instead of normal caused the error. I am running a local install however I am not sure how it will react when it comes lives. Anyone who has a solution or knows whats causing this?

PHP Selenium WebDriver using sendKeys causes redirect

I'm having a problem trying to submit the form automatically using php-webdriver client, everything went fine until one day my script was no longer able to submit the form. The process of filling form is really simple:
I have my fields that I want to populate in that form and click submit button with attribute name="submit". Everything worked fine but now the same code somehow doesn't cut it.
$input = $this->driver->findElement(WebDriverBy::name('first_name'));
$input->sendKeys('Example');
$submit = $this->driver->findElement(WebDriverBy::name('submit'));
$submit->click();
This is pretty much what my script does it finds a few fields and sends some values after that I simply click the submit button. After the submission, I checked what response I get using getPageSource() method, and surprisingly it showed me different page, but in the right circumstances it should be on the same page. If I delete every line of code that uses sendKeys() method then it stays on the same page which is the correct behavior. But I'm not understanding why sendKeys in combination with $submit->click() causes something like 'redirect' it redirects to index page which is initial website page and it used to work correctly, I checked everything many times and it looks that I provide all required fields correctly and able to submit the form. But instead of successful form submission response, I see that I'm on the index page.
Maybe there are known issues with this but I'm just not aware of it? Some advice, ways of how could I debug it would be really helpful because now I'm clueless, there's simply no indication of what went wrong.

Woocommerce showing "NULL" when completing orders manually

I've recently found that since I've installed this plugin (http://codecanyon.net/item/license-manager-for-woocommerce/5089794) whenever I try to manually change the status of an order (switching from processing to completed or the other way back) it loads a blank page when it just shows: NULL.
The strange thing is that if I back to the Order page and reload it, the status changes.
Another hint may be for example that the url when I arrive at the blank page with the "NULL" written in it, is something like this:
wp-admin/edit.php?s=&post_status=all&post_type=shop_order&_wpnonce=2d037c85cf&_wp_http_referer=%2Fwp-admin%2Fedit.php%3Fpost_type%3Dshop_order&action=mark_processing&m=0&_customer_user=&paged=1&mode=list&post%5B%5D=1117&action2=-1
What I can see there (and I might be wrong), is that after the _wpnonce appears a redirect with wrong values :S
Anything could help me? I'm kinda lost and I can't figure out where does this error comes from or make it right.
If I disable the plugin, everythings goes alright.
Greetings!

Error Redirect and upload photo

Having an interesting time trying to get an upload to work. So here's the thing: I have a form that uses some javascript to pretend it's 3 separate pages. It's all one form, but as you click "next" one section fades away and another section is shown. The last page is the page where you can make the most errors....if you miss a required field or you're trying to sign up with an already used email address the app will kick out an error, but it has to do a:
redirect(/path/to/app#!section2);
to show the correct page where the error is located. I can get all the data back, by quickly putting all the variables into a flashvar. So IF this redirect were to happen I have all the data to show back in the form....except....if you tried to upload a photo, I've lost the photo upload. My first thought was to try and save the $_FILES data to a flashvar, but I don't think that will work.
Anyone see this before? There has to be a way around this.
Thanks
I would make the entire process ajax based so you wouldn't have to worry about preserving data through redirects. You could do all of your validation in your controllers as usual and then either return json or javascript code back to the browser to parse and handle what to do next.

Drupal 5 Search not working on 404 pages

I have a <?php print $search_box; ?> in my page.tpl.php page. On pages that exist, the search works, but on 404 pages, it does not.
I saw some bugs/patches threads over at drupal.org for D6.15, but none of them seem to work according to the thread and they weren't really relevant to D5.x
I have a theory that the because the <?php print $search_box; ?> creates a form with an action to itself(a non-existant page), it'll get the 404.
Has anyone run up against this? If so, how did you fix it?
One theory I has was to somehow tap into the form and always make the action="/" (front page) which would always exist.
If this is a good idea, how does one go about tapping into the FormAPI and overwriting the action? Is it a preprocess function?
In a form alter you can use drupal_get_headers() to check if the page being displayed is a 404.
If it is a 404, you can in your form alter set the $form['#action'] attribute in your search form to fx the front page or any other page that you would like to redirect the user to.
I haven't tested this, but it should work.

Categories