/[drupal]/contributions/profiles/single_user_blog/single_user_blog.profile
ViewVC logotype

Contents of /contributions/profiles/single_user_blog/single_user_blog.profile

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Tue Jan 29 17:50:05 2008 UTC (21 months, 4 weeks ago) by add1sun
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
Changes since 1.1: +1 -1 lines
File MIME type: text/x-php
#213542: Thanks to tylor for catching and fixing a typo.
1 <?php
2 // Designed by herenbdy: herenbdy@gmail.com
3
4 function single_user_blog_profile_modules() {
5 return array('block', 'comment', 'filter', 'help', 'menu', 'node', 'system', 'user', 'watchdog',
6 //additional modules
7 'inline', 'taxonomy', 'token', 'path', 'pathauto', 'search', 'statistics', 'upload', 'views', 'views_ui');
8 }
9
10 function single_user_blog_profile_details() {
11 return array(
12 'name' => 'Blog site',
13 'description' => 'Select this profile to create a single-user blog website.'
14 );
15 }
16
17 function single_user_blog_profile_final() {
18
19 $types = array(
20 array(
21 'type' => 'page',
22 'name' => st('Page'),
23 'module' => 'node',
24 'description' => st('If you want to add a static page, like a contact page or an about page, use a page.'),
25 'custom' => TRUE,
26 'modified' => TRUE,
27 'locked' => FALSE,
28 ),
29 array(
30 'type' => 'post',
31 'name' => st('Blog post'),
32 'module' => 'node',
33 'description' => st('Create a new post to your blog.'),
34 'custom' => TRUE,
35 'modified' => TRUE,
36 'locked' => FALSE,
37 ),
38 );
39 foreach ($types as $type) {
40 $type = (object) _node_type_set_defaults($type);
41 node_type_save($type);
42 }
43 $post_help = 'UPDATE {node_type} SET `help` = \'To post an image in the body of a post, attach the image below in the File attachment section, and insert [inline:filename] in your post where you want the image to appear. The default maximum dimensions are set to 1000x1000, you may change this at <a href="admin/settings/inline"> the inline settings page.</a>'. ' \' WHERE CONVERT({node_type}.`type` USING utf8) = \'post\' LIMIT 1;';
44 db_query($post_help); // set post help box
45
46
47 $time = time();//current time
48 $url = url(NULL, NULL, NULL, TRUE);//base url
49
50
51 //setup theme
52 db_query("INSERT INTO {system} VALUES ('themes/pushbutton/page.tpl.php', 'pushbutton', 'theme', 'themes/engines/phptemplate/phptemplate.engine', 1, 0, 0, -1, 0);");
53 variable_set('theme_settings', $theme_settings);
54 variable_set('theme_default', 'pushbutton');
55 variable_set('site_name', 'My blog');
56 $theme_settings = variable_get('theme_settings', array());
57 $theme_settings['toggle_node_info_page'] = FALSE;
58 variable_set('node_options_page', array('status'));
59 variable_set('comment_page', COMMENT_NODE_DISABLED);
60
61
62 //comments
63 variable_set('comment_default_mode', '4');
64 variable_set('comment_default_order', '1');
65 variable_set('comment_default_per_page', '50');
66 variable_set('comment_controls', '3');
67 variable_set('comment_anonymous', '1');
68 variable_set('comment_subject_field', '1');
69 variable_set('comment_preview', '0');
70 variable_set('comment_form_location', '1');
71
72
73 //Setup recent posts, recent comments, and admin menu blocks
74 db_query("INSERT INTO {view_view} VALUES (1, 'posts_recent', 'Recent blog posts', '', 0, '', '', 1, '', 1, '', 1, 'node', 1, 10, '', 0, 0, 0, '', 0, 'tab', '', 0, 1, 'Recent blog posts', 0, '', 1, 0, '', 1, 0, '', 1, 'list', 5, 0, 0, $time, '', 1);");
75 db_query("INSERT INTO {view_sort} VALUES (1, 0, 'node.changed', 'DESC', 'normal', NULL);");
76 db_query("INSERT INTO {view_filter} VALUES (1, '', 'node.type', 'post', 'OR', '', 0);");
77 db_query("INSERT INTO {view_tablefield} VALUES (1, 'node', 'changed', '', 'views_handler_field_date_small', 0, '0', '', 1);");
78 db_query("INSERT INTO {view_tablefield} VALUES (1, 'node', 'title', '', 'views_handler_field_nodelink', 0, '0', 'link', 0);");
79 db_query("INSERT INTO {blocks} VALUES ('user', '1', 'pushbutton', 1, 0, 'right', 0, 0, 0, '', '');");
80 db_query("INSERT INTO {blocks} VALUES ('comment', '0', 'pushbutton', 1, 2, 'right', 0, 0, 0, '', '');");
81 db_query("INSERT INTO {blocks} VALUES ('views', 'posts_recent', 'pushbutton', 1, 1, 'right', 0, 0, 0, '', '');");
82 db_query("INSERT INTO {blocks_roles} VALUES ('user', '1', '2');"); //make navigation only accessible to admin
83
84
85 //Taxonomy
86 db_query("INSERT INTO {vocabulary} VALUES (1, 'Topic', '', '', 0, 0, 0, 0, 1, 'taxonomy', 0);");
87 db_query("INSERT INTO {vocabulary_node_types} VALUES (1, 'post');");
88
89
90 //Upload and inline settings
91 variable_set('upload_uploadsize_default', '5');
92 variable_set('upload_usersize_default', '100');
93 db_query("INSERT INTO {filters} VALUES (1, 'inline', 0, 10);");
94 variable_set('upload_post', '1');
95 variable_set('upload_inline_post', '0');
96 variable_set('inline_link_img', '1');
97 variable_set('inline_img_dim', '1000, 1000');
98
99
100 //Page views and error reporting
101 variable_set('statistics_count_content_views', '1');
102 variable_set('site_403', '');
103 variable_set('site_404', '');
104 variable_set('error_level', '0');
105
106
107 //Primary links
108 db_query("INSERT INTO {menu} VALUES (2, 0, '', 'Primary links', '', 0, 115);");
109 db_query("INSERT INTO {menu} VALUES (62, 2, '', 'Home', 'Return to home page', 0, 118);");
110
111
112 //Pathauto settings
113 variable_set('pathauto_node_page_pattern', '[title-raw]');
114 variable_set('pathauto_node_post_pattern', '[yyyy]/[mm]/[dd]/[title-raw]');
115
116
117 //Sets anonymous user permissions and disallows registration
118 db_query("UPDATE {permission} SET `rid` = 1, `perm` = 'access comments, post comments, post comments without approval, access content, search content, use advanced search, access statistics, view post access counter, view uploaded files', `tid` = 0 WHERE `rid` = 1;");
119 variable_set('user_register', '0');
120 variable_set('user_email_verification', '0');
121
122
123 //Creates a default account with username and password: admin
124 db_query("INSERT INTO {users} VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '', 0, 0, 0, '', '', '$time', '$time', 0, 1, NULL, '', '', '', NULL);");
125 drupal_set_message("<b>A default account has been created for you, the username is admin, and the password is admin, please log in and change your username/password before posting content or changing settings.</b>");
126 $url = url(NULL, NULL, NULL, TRUE);
127 $message = 'To log into your site, go to <a href="'.$url.'user">the user log-in page</a>';
128 drupal_set_message($message);
129 }

  ViewVC Help
Powered by ViewVC 1.1.2