[wpmu-trac] Re: [WordPress MU Trac] #109: Page for admin to set
site-wide defaults needed
WordPress MU Trac
wpmu-trac at lists.automattic.com
Sat Nov 4 20:26:07 GMT 2006
#109: Page for admin to set site-wide defaults needed
-------------------------+--------------------------------------------------
Reporter: mickemus | Owner: somebody
Type: enhancement | Status: new
Priority: normal | Milestone: WPMU 2.0
Component: component1 | Version: 2.0
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by mrjcleaver):
Hint taken ;)
The following gives the admin the ability to override the default links.
{{{
[wpmu at 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">
}}}
--
Ticket URL: <http://trac.mu.wordpress.org/ticket/109#comment:6>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser
More information about the wpmu-trac
mailing list