1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WPmu - How to create a new blog in php ?

Discussion in 'Blogging' started by milosz, Nov 2, 2008.

Tags:
  1. milosz

    milosz Newbie

    Joined:
    Oct 23, 2008
    Messages:
    2
    Likes Received:
    0
    hello,
    i've just installed WPmu.

    i understand how to create new posts (via xml-rpc.php) : it's very easy.

    is there a way to create new blogs via xml-rpc.php or something like that ?
     
  2. Loak

    Loak Jr. VIP Jr. VIP

    Joined:
    Apr 21, 2008
    Messages:
    314
    Likes Received:
    109
    naa thats only for posting content
     
  3. milosz

    milosz Newbie

    Joined:
    Oct 23, 2008
    Messages:
    2
    Likes Received:
    0
    i have created /wp-admin/backdoor.php (copy-paste from /wp-admin/wpmu-edit.php with little changes).

    not secure, but seems to work for me.
    create new blog for user "admin"

    PHP:
    require_once('admin.php');
    do_action('wpmuadminedit''');
            
    $domain $_GET['domain'];
    $email $_GET['email'];
    $title $_GET['title'];
    $public 1;
            
            
    //$domain = 'blog1';
    //$email = '[email protected]';
    //$title = 'Blog1 title';
    //$public = 0;
            
    $user_id email_exists($email);
            
    if( 
    constant('VHOST') == 'yes' ) {
                
    $newdomain $domain.".".$current_site->domain;
                
    $path $base;
            } else {
                
    $newdomain $current_site->domain;
                
    $path $base.$domain.'/';
            }

    $domain strtolower$domain );
    $newdomain strtolower$newdomain );
    $path strtolower$path );
            
    $id wpmu_create_blog($newdomain$path$title$user_id $public$current_site->id);

    if( 
    get_user_option$user_id'primary_blog' ) == )
        
    update_user_option$user_id'primary_blog'$idtrue );