This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Create Blog
renanivo edited this page Oct 5, 2010
·
21 revisions
Creates a new blog calling wpmu_create_blog. Just call ms.CreateBlog on your blog’s XML-RPC interface (http://yourdomain.com/xmlrpc.php), using a XML encoded request with an array containing user, password and wpmu_create_blog parameters.
e.g.
XML Request:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>ms.CreateBlog</methodName>
<params>
<param>
<value>
<string>username</string>
</value>
</param>
<param>
<value>
<string>password</string>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>domain</name>
<value>
<string>localhost</string>
</value>
</member>
<member>
<name>path</name>
<value>
<string>/path</string>
</value>
</member>
<member>
<name>title</name>
<value>
<string>Blog Title</string>
</value>
</member>
<member>
<name>user_id</name>
<value>
<string>user@example.com</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
The PHP code to generate this request:
$request = xmlrpc_encode_request("ms.CreateBlog", array(
'username',
'password',
array(
'domain' => "localhost",
'path' => "/path",
'title' => "Blog Title",
'user_id' => "user@example.com",
),
));
Note: Instead of the original wpmu_create_blog, you can use an e-mail instead of user_id. If you do it, a new user will be created (if not exists) or the user_id of the e-mail owner will be the blog owner.
This method will return the new blog ID or an error, e.g.
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<int>29</int>
</value>
</param>
</params>
</methodResponse>