Ticket #109 (new enhancement)

Opened 2 years ago

Last modified 1 month ago

Page for admin to set site-wide defaults needed

Reported by: mickemus Assigned to: somebody
Priority: normal Milestone: WPMU 2.0
Component: component1 Version: 2.0
Severity: normal Keywords:
Cc:

Description

What would be great, is a "blog defaults" options page so that all blogs can have the same bunch of settings propagated upon creation (like the links in the blog roll, default post and page etc). Now we're forced to 'hack' the functions.php file to do such changes... then when upgrading.. headache!

http://mu.wordpress.org/forums/topic.php?id=911&replies=6

Change History

07/30/06 17:43:44 changed by mickemus

08/20/06 11:29:26 changed by mrjcleaver

Is anyone wanting and able to work on these?

08/20/06 11:30:02 changed by mrjcleaver

  • summary changed from Blog defaults page! to Page for admin to set site-wide defaults needed.

09/09/06 16:27:55 changed by drmike

  • version set to 1.0.
  • milestone set to WPMU 1.0.

09/28/06 16:42:09 changed by donncha

  • version changed from 1.0 to 2.0.
  • milestone changed from WPMU 1.0 to WPMU 2.0.

Maybe for version 2, unless someone wants to submit a patch. hint-hint! :)

11/04/06 20:26:07 changed by mrjcleaver

Hint taken ;)

The following gives the admin the ability to override the default links.

[wpmu@host public_html]$ svn diff wp-includes/wpmu-functions.php wp-admin/wpmu-edit.php wp-admin/wpmu-options.php
Index: wp-includes/wpmu-functions.php
===================================================================
--- wp-includes/wpmu-functions.php      (revision 803)
+++ wp-includes/wpmu-functions.php      (working copy)
@@ -1217,11 +1217,26 @@

        $wpdb->hide_errors();

-       // Default links
        $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".addslashes(__('Blogroll'))."')");
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_owner, link_rss) VALUES ('http://wordpress.com/', 'WordPress.com', 1, '$user_id', 'http://wordpress.com/feed/');");
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_owner, link_rss) VALUES ('http://wordpress.org/', 'WordPress.org', 1, '$user_id', 'http://wordpress.org/development/feed/');");

+       // Default links
+       $default_blogroll = get_site_option('default_blogroll');
+       print "default_blogroll=$default_blogroll";
+       if (!$default_blogroll) {
+               $default_blogroll = "http://Wordpress.com Wordpress.com http://wordpress.com/feed\n".
+                                   "http://wordpress.org, WordPress.org, http://wordpress.org/development/feed/";
+       }
+       $default_blogroll_list = explode("\n",$default_blogroll);
+
+       foreach ($default_blogroll_list as $line) {
+           list($siteurl, $sitename, $feedurl) = preg_split('/[\s,]+/',$line);
+           print "line=$line\n, siteurl=$siteurl, sitename=$sitename, feedurl=$feedurl\n";
+           if ($siteurl) { // skips blank lines
+             $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_owner, link_rss) VALUES ('$siteurl', '$sitename', 1, '$user_id', '$feedurl');");
+           }
+       }
+
+
        // First post
        $now = date('Y-m-d H:i:s');
        $now_gmt = gmdate('Y-m-d H:i:s');
Index: wp-admin/wpmu-edit.php
===================================================================
--- wp-admin/wpmu-edit.php      (revision 803)
+++ wp-admin/wpmu-edit.php      (working copy)
@@ -35,6 +35,7 @@
                update_site_option( "first_post", $_POST[ 'first_post' ] );
                update_site_option( "welcome_email", $_POST[ 'welcome_email' ] );
                update_site_option( "fileupload_maxk", $_POST[ 'fileupload_maxk' ] );
+               update_site_option( "default_blogroll", $_POST[ 'default_blogroll' ] );
                $site_admins = explode( ' ', str_replace( ",", " ", $_POST['site_admins'] ) );
                if ( is_array( $site_admins ) ) {
                        $mainblog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
Index: wp-admin/wpmu-options.php
===================================================================
--- wp-admin/wpmu-options.php   (revision 803)
+++ wp-admin/wpmu-options.php   (working copy)
@@ -76,6 +76,12 @@
                <th scope="row"><?php _e('Max upload file size:') ?></th>
                <td><input name="fileupload_maxk" type="text" id="fileupload_maxk" value="<?php echo get_site_option('fileupload_maxk', 300) ?>" size="5" /> KB
                </tr>
+               <tr valign="top">
+               <th scope="row"><?php _e('Default blogroll:') ?></th>
+                <td><textarea name="default_blogroll" id="default_blogroll" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('default_blogroll') ) ?></textarea>
+                <br />
+                <?php _e('$siteurl, $sitename, $feedurl separated by commas or spaces') ?></td>
+               </tr>
                </table>
        </fieldset>
        <fieldset class="options">

07/10/07 12:27:21 changed by mrjcleaver

Any chance this can be submitted?

Thanks, M.

08/27/07 01:54:27 changed by mrjcleaver

No comment? Feedback, please!

05/24/08 00:26:55 changed by jeremyclarke

+1 on this idea. If it becomes a 2.0 feature, then it would be great if it also incorporated the ability to optionally affect all existing blogs as well, so that, you could alter all blogs simultaneously (e.g. to configure a new plugin installed in mu-plugins.)

I guess you could just do this yourself by coding a plugin that sets the options and putting it in mu-plugins, but an admin screen would be nice. That said, I can't imagine a simple AND full version of what I'm asking for, so it depends on the genius imagination of others.