Outside Links collection sticky icon

Sometimes you find just the right resources that fulfill certain need and nothing much should be added to them, in those cases I will just collect them on this page and add short comment why is this so.

How to combine Git and Drush to have perfect workflow for site maintenance, information and examples are here
http://www.jenlampton.com/blog/keeping-your-drupal-site-date-git-and-drush

Setting upt perfect Git + Drush workflow, read here
http://www.acquia.com/blog/using-git-drush-win-workflow

Show variables in devel way(krumo) with watchdog

watchdog('debug',kprint_r($var, TRUE, NULL));

Integrating 3rd party libraries to drupal 7, libraries with namespaces

I am trying to integrate pay with amazon to drupal site and had a hello of a time, trying to figure out how to do that. They use namespaces and that is not something so common in drupal 7. So to understand it better, check out this video and this blog post

How to use namespaces and what are they
http://buildamodule.com/video/drupal-8-developer-prep-namespacing-and-au...

How to properly setup namespaces in drupal 7 and combine it with drupal 7 code
http://pixel5.us/node/35

hook_form_alter is not called if form fails validation

There is interesting discusion about this here
https://www.drupal.org/node/671574#comment-6466782

and basically how form is cached once something is entered in it, so if validation fails, form will ignore hook_form_alters in that case and loose changes you made. There is a good comment about that here https://www.drupal.org/node/671574#comment-9441525

"It's even incorrect to state that forms are only built once by design, because they aren't. They're only built once if caching is enabled.
..."

Solutions are to use #attached, #after_build and perhaps #pre_render.

An overview of Drupal's cache_clear_all uses

Drupal has a very simple, yet powerful (low level) caching system. It provides 3 functions that should please all you caching needs: cache_get, cache_set and cache_clear_all. The first two are pretty straight forward to use, but the third one might take some time to wrap your head around.
It accepts 3 argument: a cache ID, table cache and a wilcard boolean. Each combination of these 3 has a very different result. Here's an overview of all combinations.
cache_clear_all()
Passing no arguments to cache_clear_all is the same as saying the following

cache_clear_all(NULL, 'cache_block');

"Price is locked and cannot be edited" - how to unlock this or any other field

So to cut it short, just write this in your code, probably devel/php, change the filed name and you will have unlock a filed (probably commerce_price field).

$field_name = 'field_name';
$field = field_read_field($field_name);
$field['locked'] = 0; // 0: unlock; 1: lock.
field_update_field($field);

After you do what you need to do, you should put it back to lock.

Importing wordpress (ver 3 and 4) users to Drupal 7, how to solve password problem

So importing data from WP is not so hard, you can do it in different ways, mapping data as you need. But what to do about passwords. they are encrypted, WP uses "one-way encryption" and you will need hacker to know what is in them. There are 2 methods.

1. Copy paste

Logging mysql on localhost

In mysql 5.6+. Use this:

[mysqld]
general_log = on
general_log_file=/usr/log/general.log

in your my.cnf / my.ini file

http-response set-header X-Frame-Options DENY will break AJAX on edit forms

We had on server this thing set
http-response set-header X-Frame-Options DENY

Which in the end made all the ajax form on node edit/add, product edit/add stop working and throwing out errors on browser console.
Refused to display 'https://dev.site.com/system/ajax' in a frame because it set 'X-Frame-Options' to 'DENY'.

So this cant be used that way in drupal.

DB Uploading from local to remote

mysqldump -u user -p databasename > dump.sql

Then using SCP transfer the file to the remote server:

scp dump.sql user@remotehost.ip:

Then use the mysql client there to import the dump.sql with:

mysql -u user_name -p databasename < dump.sql