Increase flood limit and flood interval in Drupal 8
If you are using Contact form in Drupal 8 and you ever got following error:
"You cannot send more than 5 messages in 1 hour. Try again later"
and if for some reason you want to increase that, then you will want to increase flood limit. However in Drupal 8 just like in Drupal 7 flood control variables are hidden, meaning you can't change them through UI. For Drupal 7 we had a nice Flood control module but it hasn't been ported to Drupal 8 yet.
variable_get and variable_set in Drupal 8
variable_get()/variable_set() and variable_del() API was removed from Drupal 8 in favor of Configuration API.
So in order to save a simple variable in your module firstly you need to decide on a config object name and a name for the settings. Simple settings can be stored in a config object named <module_name>.settings, while for more complex settings it is advisable to use sub-keys.
To get a variable in Drupal 7 you would use:
How to retrieve site wide email address in Drupal 8
In Drupal 7 you would easily retrieve site wide email address through variable:
<?php $site_email = variable_get('site_mail', ''); ?>
However in Drupal 8 variables are gone in favor of configuration objects. So the same functionality in Drupal 8 would be:
<?php $system_site_config = \Drupal::config('system.site'); $site_email = $system_site_config->get('mail'); ?>
Drupageddon - Updating to Drupal 7.32 is not enough, your site may already be hacked!
Following up on the Drupageddon, I noticed something weird on one of my servers. While patching sites to Drupal 7.32, I noted that on some of the sites database.inc was already updated with todays date! I was sure nobody made the change so I went into investigating this more.
I made a diffcheck via git and discovered there was additional file on my server!
"You don't have permission to access /phpMyAdmin on this server" after upgrading to Yosemite
I upgraded my Mac to Mac OS X Yosemite.
I had a LAMP stack installed and it worked fine.
After upgrading to Yosemite, I got following problem:
when trying to load phpMyAdmin at http://localhost/phpMyAdmin I get the following error:
Forbidden. You don't have permission to access /phpMyAdmin on this server.
First thing I tried to do is to change file permissions in /phpMyAdmin folder to match those of www, but that didn't help.
Drupageddon - SA-CORE-2014-005 - Drupal 7 SQL injection exploit demo
Yesterday Drupal security team announced highly critical bug at https://www.drupal.org/SA-CORE-2014-005. Looking at the actual patch which is simply:
Change Drupal admin password using Drush
Today I wanted to share very handy tip, on how can I change a user's Drupal password from the command-line with Drush?
Very easy using drush upwd command:
drush upwd USERNAME --password="SOMEPASSWORD"
This should work for all versions of Drupal.
Customer Support via Twilio SMS with Zendesk v2
Recently I was challenged to integrate Twilio SMS channel via Zendesk. If you're not familiar with Zendesk, it's a helpdesk system that allows customers to create tickets by sending email which support staff can respond to and create certain workflows. More about Zendesk here.
For SMS part I decided to use Twilio since I am already familiar with their API. More about Twilio here.
Drupal translate custom module
If you created your custom Drupal module and you wonder how to translate it in other language then you came to the right place!
In few simple steps I ll show you how to export translatable strings from your custom module and import them in Drupal translation interface.
How to reset admin password in Drupal 7
Previously for Drupal 6 site, when you forgot or didn't know the admin password, you could easily change it via database by following query:
UPDATE users SET pass = MD5('mynewpassword') WHERE uid = 1;
However if you tried that in Drupal 7 site you will see it doesn't work! Thats because Drupal 7 stores a salted SHA512 hash instead of MD5 hex hash. To get new password you must use the user_hash_password('mypassword') function (located in includes/password.inc), then paste it into the database.