2. @chillin411
What is an install profile?
• Set of instructions that Drupal runs during the install
process
• Easy way to ENABLE (compare to DOWNLOAD using
Drush Make) modules at install.
• Can do practically anything using PHP
3. @chillin411
Why should I use them?
• Extremely easy to write
• Can start small and add to it as time goes by
• There's no reason to do the same setup tasks over and
over.
• Does the 2nd half of the work that you do with Drush
Make.
4. @chillin411
Cool things you can do:
• Enable modules at install
• Set an administration theme
• Add a new input format and configure it to use CKEditor
• Add users, nodes, or roles
• Create default content
• Anything you can do with PHP
5. @chillin411
Drupal 6 Install Profiles
• Composed of one file.profile
• Several PHP hooks
o hook_profile_modules()
o hook_profile_details()
o hook_profile_task_list()
o hook_profile_tasks()
o hook_form_alter()
6. @chillin411
Drupal 7 Install Profiles
• Consists of 3 files
o profile.info
Similar to a module .info file (install modules here)
o profile.install
Similar to a module's .install file (most of your
editing will go here)
o profile.profile
Similar to a module's .module file (form_alters, etc)
8. @chillin411
Cool thing #2 - Default Themes
• variable_set('admin_theme', 'Rubik');
o D6 - Put in hook_profile_tasks
o D7 - Put in hook_install
• variable_set('theme_default', 'Bartik');
9. @chillin411
Cool thing #3 - Create Admin Role
• D6 - hook_profile_tasks()
o $form_state = array();
$form_state['values']['name'] = 'Administrator';
$form_state['values']['op'] = t('Create admin role');
drupal_execute('user_admin_new_role', $form_state);
• Alternatively, you can use a db_query, but be careful about this -
notice lack of INTO, and lack of rid key.
o db_query("INSERT {role} (name) VALUES ( 'Administrator')");
10. @chillin411
How to get started?
• In Drupal 6, copy the /profiles/default folder, rename the
folder, .profile and function hook names to match your
profile.
• In Drupal 7, use the /profiles/standard instead of
profiles/minimal (more stuff there to work with)
• If you're enabling modules, make sure to have them
already downloaded. Drush make is awesome for this.
• Start editing, and looking at variables table.
11. @chillin411
One trick on the variables table
• Variables in the variable table are serialized.
o a:3:{i:0;s:4:"node";i:1;s:8:"taxonomy";i:2;s:4:"user";}
o array(0 => "node", 1 => "taxonomy", 2 => "user")
• So, if you want to add this to the variables table
(pathauto does this automatically, just an example)
o $array_pathauto_modulelist = array(0 => "node", 1 =>
"taxonomy", 2 => "user");
o variable_set('pathauto_modulelist',
$array_pathauto_modulelist);