summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-08-09 12:53:32 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-08-09 12:53:32 +0000
commit068410935a1b81a893a5b7e669d679403319f211 (patch)
treedbdf5935bbde43bab7eb6d416dc270877841b64d
parented91d25af59c6c796ba41cf6d748d5d8427caf70 (diff)
downloadwordpress-mu-068410935a1b81a893a5b7e669d679403319f211.tar.gz
wordpress-mu-068410935a1b81a893a5b7e669d679403319f211.tar.xz
wordpress-mu-068410935a1b81a893a5b7e669d679403319f211.zip
Use blog's default role when editing it, props jeffoire, fixes #399
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1037 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-admin/wpmu-blogs.php39
1 files changed, 22 insertions, 17 deletions
diff --git a/wp-admin/wpmu-blogs.php b/wp-admin/wpmu-blogs.php
index 5dbf702..2f3ae19 100644
--- a/wp-admin/wpmu-blogs.php
+++ b/wp-admin/wpmu-blogs.php
@@ -16,14 +16,15 @@ switch( $_GET[ 'action' ] ) {
$id = intval( $_GET[ 'id' ] );
$options_table_name = "$wpmuBaseTablePrefix{$id}_options";
$options = $wpdb->get_results( "SELECT * FROM {$options_table_name} WHERE option_name NOT LIKE 'rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A );
- $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$_GET[ 'id' ]}'", ARRAY_A );
+ $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$id}'", ARRAY_A );
+ $editblog_roles = get_blog_option( $id, "$wpmuBaseTablePrefix{$id}_user_roles" );
print "<h2>" . __('Edit Blog') . "</h2>";
print "<a href='http://{$details[ 'domain' ]}/'>{$details[ 'domain' ]}</a>";
?>
<form name="form1" method="post" action="wpmu-edit.php?action=updateblog">
<?php wp_nonce_field( "editblog" ); ?>
- <input type="hidden" name="id" value="<?php echo $_GET[ 'id' ] ?>" />
+ <input type="hidden" name="id" value="<?php echo $id ?>" />
<table><td valign='top'>
<div class="wrap">
<table width="100%" border='0' cellspacing="2" cellpadding="5" class="editform">
@@ -78,16 +79,19 @@ switch( $_GET[ 'action' ] ) {
<br />
</td></tr>
<?php
- while( list( $key, $val ) = each( $options ) ) {
- $disabled = '';
- if ( is_serialized($val[ 'option_value' ]) ) {
- if ( is_serialized_string($val[ 'option_value' ]) ) {
- $val[ 'option_value' ] = wp_specialchars(maybe_unserialize($val[ 'option_value' ]), 'single');
- } else {
- $val[ 'option_value' ] = "SERIALIZED DATA";
- $disabled = ' disabled="disabled"';
+ $editblog_default_role = 'subscriber';
+ while( list( $key, $val ) = each( $options ) ) {
+ if( $val[ 'option_name' ] == 'default_role' )
+ $editblog_default_role = $val[ 'option_value' ];
+ $disabled = '';
+ if ( is_serialized($val[ 'option_value' ]) ) {
+ if ( is_serialized_string($val[ 'option_value' ]) ) {
+ $val[ 'option_value' ] = wp_specialchars(maybe_unserialize($val[ 'option_value' ]), 'single');
+ } else {
+ $val[ 'option_value' ] = "SERIALIZED DATA";
+ $disabled = ' disabled="disabled"';
+ }
}
- }
if ( stristr($val[ 'option_value' ], "\r") or stristr($val[ 'option_value' ], "\n") or stristr($val[ 'option_value' ], "\r\n") ) {
?>
<tr valign="top">
@@ -143,7 +147,7 @@ switch( $_GET[ 'action' ] ) {
print $out;
print "</table></div>";
}
- $blogusers = get_users_of_blog( $_GET[ 'id' ] );
+ $blogusers = get_users_of_blog( $id );
print '<div class="wrap"><h3>' . __('Blog Users') . '</h3>';
if( is_array( $blogusers ) ) {
print '<table width="100%"><caption>' . __('Current Users') . '</caption>';
@@ -160,11 +164,11 @@ switch( $_GET[ 'action' ] ) {
if( $val->user_id != $current_user->data->ID ) {
?>
<td><select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
- foreach($wp_roles->role_names as $role => $name) {
+ foreach( $editblog_roles as $role => $role_assoc ){
$selected = '';
if( $role == $existing_role )
$selected = 'selected="selected"';
- echo "<option {$selected} value=\"{$role}\">{$name}</option>";
+ echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>";
}
?></select></td><td><input type='text' name='user_password[<?php echo $val->user_id ?>]'></td><?php
print '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . $val->user_id . ']"></td>';
@@ -184,11 +188,12 @@ switch( $_GET[ 'action' ] ) {
<tr>
<th scope="row"><?php _e('Role:') ?></th>
<td><select name="new_role" id="new_role"><?php
- foreach($wp_roles->role_names as $role => $name) {
+ reset( $editblog_roles );
+ foreach( $editblog_roles as $role => $role_assoc ){
$selected = '';
- if( $role == 'subscriber' )
+ if( $role == $editblog_default_role )
$selected = 'selected="selected"';
- echo "<option {$selected} value=\"{$role}\">{$name}</option>";
+ echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>";
}
?></select></td>
</tr>