wordpress-mu-1.2.3 : Site Admin : Blogs : Edit Blog
1) displays the roles for the blog logged in under rather than the roles for the blog being edited
2) always marks "Subscriber" as the selected role for Add User rather than the default role specified in options
--- wp-admin\wpmu-blogs.php 2007-05-28 12:50:56.000000000 -0600
+++ wpmu-blogs.php 2007-08-01 18:07:49.645373100 -0600
@@ -17,6 +17,7 @@
$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 );
+ $editblog_roles = get_blog_option( $id, "$wpmuBaseTablePrefix{$id}_user_roles" ); // jao 20070801 get the list of roles for target blog
print "<h2>" . __('Edit Blog') . "</h2>";
print "<a href='http://{$details[ 'domain' ]}/'>{$details[ 'domain' ]}</a>";
@@ -79,6 +80,7 @@
</td></tr>
<?php
while( list( $key, $val ) = each( $options ) ) {
+ if( $val[ 'option_name' ] == 'default_role' )$editblog_default_role = $val[ 'option_value' ]; // jao 20070801 use this instead of hardcoded 'subscriber'
$disabled = '';
if ( is_serialized($val[ 'option_value' ]) ) {
if ( is_serialized_string($val[ 'option_value' ]) ) {
@@ -151,11 +153,11 @@
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 ){ // jao 20070801 using "raw" role data instead of making an object
$selected = '';
if( $role == $existing_role )
$selected = 'selected="selected"';
- echo "<option {$selected} value=\"{$role}\">{$name}</option>";
+ echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>"; // jao 20070801 using "raw" role data instead of making an object
}
?></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>';
@@ -175,11 +177,11 @@
<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) {
+ foreach( $editblog_roles as $role => $role_assoc ){ // jao 20070801 using "raw" role data instead of making an object
$selected = '';
- if( $role == 'subscriber' )
+ if( $role == $editblog_default_role ) // jao 20070801 replace the hardcoded default role with the actual value fetched from options
$selected = 'selected="selected"';
- echo "<option {$selected} value=\"{$role}\">{$name}</option>";
+ echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>"; // jao 20070801 using "raw" role data instead of making an object
}
?></select></td>
</tr>