1

The module IP Geolocation Views & Maps has a ton of great features. By default, the data collection option: Employ the Google Maps API to reverse-geocode HTML5 visitor locations to street addresses is turned on.

Is there a way to turn off this option via a drush command, or through some code? I have automated our site setup process, and would like to ensure this option is turned off without requiring admins to click off the option in the admin UI.

1

You can use the drush variable-set command for this:

~$ drush help variable-set
Set a variable.

Examples:
 drush vset --yes preprocess_css TRUE      Set the preprocess_css variable to  
                                           true. Skip confirmation if variable 
                                           already exists.                     
 drush vset --exact maintenance_mode 1     Take the site offline; skips        
                                           confirmation even if                
                                           maintenance_mode variable does not  
                                           exist. Variable is rewritten to     
                                           site_offline for Drupal 6.          
 drush vset pr TRUE                        Choose from a list of variables     
                                           beginning with "pr" to set to       
                                           (bool)true.                         
 php -r "print                             Set a variable to a complex value   
 json_encode(array('drupal',               (e.g. array)                        
 'simpletest'));"  | drush vset                                                
 --format=json                                                                 
 project_dependency_excluded_dependencies                                      
 -

Arguments:
 name                                      The name of a variable or the first  
                                           few letters of its name.             
 value                                     The value to assign to the variable. 
                                           Use '-' to read the object from      
                                           STDIN.

Options:
 --exact                                   The exact name of the variable to    
                                           set has been provided; do not prompt 
                                           for similarly-named variables.       
 --format=<boolean>                        Format to parse the object. Use      
                                           "auto" to detect format from value   
                                           (default), "string", "integer" or    
                                           "boolean" for corresponding          
                                           primitive type, and "json" for JSON. 
 --yes                                     Skip confirmation if only one        
                                           variable name matches.

To use this, you need to figure out the machine name for the variable. On system settings forms, this will be the $form key in the builder function. You can also poke through the variable list from the Devel module, and look for the variable name there. If you use Inspect Element (or whatever it is called in your browser), it will be the name attribute on the input or select element.

1
  • Using your detective support, I derived the following command: drush vset ip_geoloc_google_to_reverse_geocode 0 – Jay Haase Jul 28 '14 at 16:31
0

You can always add it to your settings.php and set it to off.

Look in "variables" table for the value you need and add, something like this:

$conf['name_of_variable'] = 'value_you_want';

Simple example: $conf['maintenance_theme'] = 'bartik';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.