'. t("Dumps a Drupal profile straight from the database. It needs editing, but will constitute a good start."). '

'; break; } return $output; } /** * Valid permissions for this module * @return array An array of valid permissions for the profile_wizard module */ function profile_wizard_perm() { return array('access profile wizard'); } /** * Implementation of hook_menu(). * * You must implement hook_menu() to emit items to place in the main menu. * This is a required step for modules wishing to display their own pages, * because the process of creating the links also tells Drupal what * callback function to use for a given URL. The menu items returned * here provide this information to the menu system. * * With the below menu definitions, URLs will be interpreted as follows: * * If the user accesses http://example.com/?q=foo, then the menu system * will first look for a menu item with that path. In this case it will * find a match, and execute jacquard_foo(). * * If the user accesses http://example.com/?q=bar, no match will be found, * and a 404 page will be displayed. * * If the user accesses http://example.com/?q=bar/baz, the menu system * will find a match and execute jacquard_baz(). * * If the user accesses http://example.com/?q=bar/baz/1/2, the menu system * will first look for bar/baz/1/2. Not finding a match, it will look for * bar/baz/1. Again not finding a match, it will look for bar/baz. This * time it finds a match, and so will execute jacquard_baz(1,2). Note * the parameters being passed; this is a very useful technique. * * If the user accesses http://example.com/?q=bar/baz/52/97, the menu system * finds a match, but since its callback is absent, it proceeds * as above and ends up calling jacquard_baz(52,97) nonetheless. */ function profile_wizard_menu($may_cache) { $items = array(); // The $may_cache parameter is used to divide menu items into two parts. Those // returned when $may_cache is true must be consistently applicable for the // current user at all times; the others may change or be defined at only // certain paths. Most modules will have excusively cacheable menu items. $items[] = array( 'path' => 'profile_wizard', 'title' => t('Profile Wizard'), 'callback' => 'profile_wizard_page', 'access' => user_access('access profile wizard'), 'type' => MENU_CALLBACK); return $items; } function profile_wizard_page() { $profile = arg(1); /********************************************************************** * Modules **********************************************************************/ $output = <<status && $module->name != 'profile_wizard') { if (!isset($module->info['package']) || !$module->info['package']) { $module->info['package'] = 'Other'; } $packages[$module->info['package']][$module->name] = $module->info; } } ksort($packages); // Output in order. foreach ($packages as $package => $modules) { $output .= << $module) { $output .= "'$name', "; } $output .= "\n"; } $output .= << st('Profile installation name'), 'description' => st('Profile installation description.') ); } EOT; /********************************************************************** * Final configuration **********************************************************************/ $output .= << $type) { $types[$name] = get_object_vars($type); } $types_code = var_export($types, true); $output .= << $value) { $output .= " variable_set('$name', " . var_export($value, true) . ");\n"; } $output .= <<rid] = explode(',', $permission->perm); } foreach (user_roles() as $role_id => $role_name) { $perms = var_export($permissions[$role_id], true); if ($role_id > 2) { $output .= " install_set_permissions(install_add_role('$role_name'), $perms);\n"; } else { $output .= " install_set_permissions($role_id, $perms);\n"; } } $output .= <<' . $output . ''; }