You are hereDrupal 7
Drupal 7
Varnish makes forms like node add/edit "timeout" or not submit
I had a strange problem with Varnish, when users used form for longer period, like they inputed data and then submitted if it was 120 seconds or more, edit page would just refresh and nothing would be submitted. So I played with TTLs https://www.linode.com/docs/websites/varnish/getting-started-with-varnis..., then with pipe_timeout
Drupal commerce checkout redirect pause
When using different payment methods for checkout, sometimes you will have a payment gateway that will redirect you to different page, like paypal. But what if you want to have your frontender a chance to look at a page before redirect to style it?
You will need to stop the redirect, to do that just find that payment method info function in module, like the one below and change
'offsite_autoredirect' => TRUE, to 'offsite_autoredirect' => FALSE,
$payment_methods = array();
Git setup with hook for post-receive.
I have setup a simple git workflow.
In one directory on server I made bare repositroy
$ git init --bare
and in other one a folder for my live site
then in the git-dir folder edit the post-receive hook
and add this to file
GIT_WORK_TREE=/var/www/www.example.org git checkout -f
after that, make this file excutable
Checking my.cnf settings that are not set
On my WAMP, or MAMP or normal server you may wonder what are the settings for your MySQL that are not set in my.cnf file. There are lot of them and to get quick look at defaults all you need is to run query (you can run it in phpmyadmin for example)
and you will have all the variables and their values shown.
Create a view with specific number of columns per row without table
My frotend guy asked me to put 3 columns of data per one row in views output so he can put zen grids over them. Not sure if he really needs that but I made it for him with a view template. Selected unformmated display style type, created template
views-view-unformatted--taxonomy-term.tpl.php and added the code that detects when number 3 occurs, or to say what it in code, we check the ID and if it is divided by 3 and has no leftover (% module operator) then we detect it is time for a new group. Here it is:
Page to change only password and email
We needed to have a custom page or a block to only change email and password on that page, and the other user info we separated in different page. Sounds like a nice solution for users. So what we did is the following.
-custom menu item
-custom form
-validation and submit
Most of the code has been taken from user.module and adjusted to fit the need we have. So here is the code, ready to use.
* Implements hook_menu().
*/
function password_email_form_menu() {
$items = array();
$items['change-credentials/%user'] = array(
Cancel button on drupal forms
This one is short but sweet. Usually drupal forms don't have cancel buttons that bring you back to previous page, so lets add one.
$form['actions']['cancel'] = array(
'#markup' => l(t('Cancel'), 'user'),
'#weight' => '666',
);
}
This will appear on user edit form and bring you back to user page when clicked.
Set the default address on shipping information with smart IP, refresh whole form to have proper counties(administrative area)
The title says it all :) add this to your module, into hook_form_alter and rock
//in otherwise, let this section only happen once, and let ajax make changes as expected
if (!(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')) {
if ($form_id == 'commerce_checkout_form_checkout') {
Debug entitys etc
When debuging enteties normal dpm with devel module just wont do you any good. So use this
http://drupal.stackexchange.com/questions/33473/is-there-a-good-way-to-i...
and this for debugging or introspecting wrappers
Drush
If you are running into this error while using drush
Directory ..../drush/cache/default exists, but is not writable. [error] Please check directory permissions.
Run this to solve it
sudo chown -R $USER ~/.drush