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:
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'); ?>
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!
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.
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:
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.
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.
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.
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.
Considering you configured your VoIP Drupal with one of the providers, here is the sample code snippet that sends "Hello world" SMS:
<?php $number = '+1234567890123'; //Number to send SMS to. Must be in E.164 format. $call = new VoipCall(); $call->setDestNumber($number); $text = 'Hello from VoIP Drupal'; voip_text($text, $call); ?>
Pretty cool, right?