summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-07-11 14:45:39 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-07-11 14:45:39 +0000
commit6f4bb7f443a18d6cbf0d60406ac852dda083025b (patch)
treebb56f42171453d948db9e33e7d8da8d21322d188
parent8987b0de0c3ab0dffc3b76c3b5a735cd96e8e5cf (diff)
downloadwordpress-mu-6f4bb7f443a18d6cbf0d60406ac852dda083025b.tar.gz
wordpress-mu-6f4bb7f443a18d6cbf0d60406ac852dda083025b.tar.xz
wordpress-mu-6f4bb7f443a18d6cbf0d60406ac852dda083025b.zip
Removed feeds config code.
Added admin "Add User" and "Add Blog" forms. git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@651 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-admin/wpmu-blogs.php20
-rw-r--r--wp-admin/wpmu-edit.php64
-rw-r--r--wp-admin/wpmu-users.php12
3 files changed, 87 insertions, 9 deletions
diff --git a/wp-admin/wpmu-blogs.php b/wp-admin/wpmu-blogs.php
index a412e4c..80719b9 100644
--- a/wp-admin/wpmu-blogs.php
+++ b/wp-admin/wpmu-blogs.php
@@ -517,6 +517,26 @@ foreach($posts_columns as $column_name=>$column_display_name) {
<input type='hidden' name='redirect' value='<?php echo $_SERVER[ 'REQUEST_URI' ] ?>'>
<input type='submit' value='Apply Changes'></p>
</form>
+
+</div>
+<div class="wrap">
+<h2>Add Blog</h2>
+<form name="addform" method="post" action="wpmu-edit.php?action=addblog">
+<?php wp_nonce_field('add-blog') ?>
+<table>
+<tr><th scope='row'>Blog Address</th><td><?php
+if( constant( "VHOST" ) == 'yes' ) {
+ ?><input name="blog[domain]" type="text" title="Domain"/>.<?php echo $current_site->domain;?></td></tr><?php
+} else {
+ echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="Domain"/></td></tr><?php
+} ?>
+<tr><th scope='row'>Blog Title</th><td><input name="blog[title]" type="text" title="Title"/></td></tr>
+<tr><th scope='row'>Admin Email</th><td><input name="blog[email]" type="text" title="Email"/></td></tr>
+<tr><td colspan='2'>A new user will be created if the above email address is not in the database.</td></tr>
+</table>
+<input type="submit" name="go" value="Add Blog" />
+</form>
+</div>
<?php
break;
diff --git a/wp-admin/wpmu-edit.php b/wp-admin/wpmu-edit.php
index 766fd94..dcba805 100644
--- a/wp-admin/wpmu-edit.php
+++ b/wp-admin/wpmu-edit.php
@@ -63,18 +63,66 @@ switch( $_GET[ 'action' ] ) {
}
exit;
break;
- case "updatefeeds":
+ case "adduser":
if( is_site_admin() == false ) {
die( __('<p>You do not have permission to access this page.</p>') );
}
+ check_admin_referer('add-user');
+
+ if( is_array( $_POST[ 'user' ] ) == true ) {
+ $user = $_POST['user'];
+ $password = generate_random_password();
+ $user_id = wpmu_create_user(wp_specialchars( $user['username'] ), $password, wp_specialchars( $user['email'] ) );
+ if(false == $user_id) {
+ die( __("<p>There was an error creating the user</p>") );
+ } else {
+ wp_new_user_notification($user_id, $password);
+ }
+ wpmu_admin_do_redirect( "wpmu-users.php" );
+ }
+
+ break;
+
+ case "addblog":
+ if( is_site_admin() == false ) {
+ die( __('<p>You do not have permission to access this page.</p>') );
+ }
+
+ check_admin_referer('add-blog');
+
+ if( is_array( $_POST[ 'blog' ] ) == true ) {
+ $blog = $_POST['blog'];
+ $domain = wp_specialchars( $blog['domain'] );
+ $email = wp_specialchars( $blog['email'] );
+ if( constant( "VHOST" ) == 'yes' ) {
+ $newdomain = $domain.".".$current_site->domain;
+ $path = $base;
+ } else {
+ $newdomain = $domain;
+ $path = $base.$domain.'/';
+ }
+
+ $user_id = email_exists($email);
+ if( !$user_id ) { // I'm not sure what this check should be.
+ $password = generate_random_password();
+ $user_id = wpmu_create_user( $domain, $password, $email );
+ if(false == $user_id) {
+ die( __("<p>There was an error creating the user</p>") );
+ } else {
+ wp_new_user_notification($user_id, $password);
+ }
+ }
- update_site_option( "customizefeed1", $_POST[ 'customizefeed1' ] );
- update_site_option( "customizefeed2", $_POST[ 'customizefeed2' ] );
- update_site_option( "dashboardfeed1", $_POST[ 'dashboardfeed1' ] );
- update_site_option( "dashboardfeed2", $_POST[ 'dashboardfeed2' ] );
- update_site_option( "dashboardfeed1name", $_POST[ 'dashboardfeed1name' ] );
- update_site_option( "dashboardfeed2name", $_POST[ 'dashboardfeed2name' ] );
- wpmu_admin_do_redirect( "wpmu-feeds.php" );
+ $wpdb->hide_errors();
+ $blog_id = wpmu_create_blog($newdomain, $path, wp_specialchars( $blog['title'] ), $user_id ,'', $current_site->id);
+ $wpdb->show_errors();
+ if( !is_wp_error($blog_id) ) {
+ wpmu_admin_do_redirect("wpmu-blogs.php");
+ } else {
+ die( $blog_id->get_error_message() );
+ }
+ }
+
break;
case "updateblog":
if( is_site_admin() == false ) {
diff --git a/wp-admin/wpmu-users.php b/wp-admin/wpmu-users.php
index a8e556c..78204e0 100644
--- a/wp-admin/wpmu-users.php
+++ b/wp-admin/wpmu-users.php
@@ -333,7 +333,17 @@ foreach($posts_columns as $column_name=>$column_display_name) {
<?php
}
-
?>
</div>
+<form name="addform" action="wpmu-edit.php?action=adduser" method="post">
+<div class="wrap">
+<h2><?php _e('Add User') ?></h2>
+<?php wp_nonce_field('add-user') ?>
+<table>
+<tr><th scope='row'>Username</th><td><input type="text" name="user[username]" /></td></tr>
+<tr><th scope='row'>Email</th><td><input type="text" name="user[email]" /></td></tr>
+</table>
+<input type="submit" name="Add user" value="Add user" />
+</form>
+</div>
<?php include('admin-footer.php'); ?>