Announcing: Rules Set Site Variables Module
Wouldn’t it be cool if you could use Drupal Rules to set, change or modify certain site configurations and variables? Yes, it would be awesome and now it is possible with "Rules Set Site Variables” module.
"Rules Set Site Variables” allows you to use the power of Drupal Rules to change site configuration and site variables on your Drupal Site. Create a rule or rules action and then add the action Set Drupal Site variable. You can configure which site variable you want to modify and text you want to change or modify.
Not the sexiest module name, but it gets the job done. Here’s how to use and some possible example use cases.
How to Use?
- Download and Enable "Rules Set Site Variables” (as well as Rules and any other modules you need)
- Create a Rule using some kind of Reaction Event (and add any additional conditions)
- Alternatively create an Action Component
- After, create an Action called "Set Drupal Site variable” under “System”
- Select the site variable you want to set.
- Add the text (or use a Replacement Pattern) to set that variable.
- Prosper.
What is this module for?
This module for lazy site builders that want to use the power of Rules to modify site configuration in various ways. In my particular use case, I’m using Rules Scheduler to set rules to change certain site properties at different intervals. You can use this module to change site configuration according to certain events, conditions or whatever you can imagine.
Obviously changing your site configuration in this way can do some bad things to your site, so be smart and use with caution. This module is not responsible for any mistakes you make in using it.
How you might use it?
The possibilities of this module are not quite endless. (It literally sets site variables). But some cool examples would be:
- Enable certain site settings when a certain user logs in.
- Periodically change a site configuration according to a schedule.
- According to the date, set something funky on the site like a configuration color or whatever.
- Set the site title according to certain reaction events.
- Change out configuration settings from DEV to PROD according to certain conditions.
Learn More
Learn about this module on its Drupal.org project page at https://www.drupal.org/project/rules_set_site_variables. I’d appreciate any comments, feedback and bug reports.
This module ain’t going to cure cancer or pay your bills, but it definitely solved an itch I had and hope it solves one of yours one day.
Tags: drupalRulesDrupal PlanetPlanet Drupaldrupal module
Mark Koester
@markwkoester
Mark has worked on Drupal since the early days of D6. He is passionate about open source as well as entrepreneurship. When he isn't building, he enjoys traveling and speaking one of his many foreign languages.
Chengdu, China