Wordpress多站点-以编程方式创建用户


Wordpress Multi-Site -Create Users programmatically

我想通过直接将数据插入mySQl数据库,同时在我的Word Press MultiSite上以编程方式与用户创建博客。

Wordpress多站点(启用网络)似乎是一个类似的问题,但我似乎无法实现那里提供的解决方案。有人能帮助实现这一点的基础吗?

您应该在此处使用wordpress多站点插件。您只需要使用multisite中的新路径进行单个方法调用即可创建新博客。下面是一个使用apachexml-rpc-api-的示例

public class Demo
{
  public static void main(String[] args)
  {
    System.out.println("Starting adicXmlRpcServer test"); 
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); 
    try
    { 
      config.setServerURL(new URL("http://localhost/wordpress/xmlrpc.php")); 
    }
    catch (MalformedURLException ex) 
    { 
      System.out.println("Invalid url....."+ex.getMessage());
      ex.printStackTrace(); 
    } 
    XmlRpcClient client = new XmlRpcClient(); 
    client.setConfig(config); 
    Map map = new HashMap();
    map.put("domain","localhost");
    map.put("path","/newStrore");
    map.put("title","newStrore");
    map.put("user_id","akhi0gupta007@gmail.com");
    Object[] params = new Object[] {new String("admin"),new String("9868"),map}; 
    try 
    { 
      Object result = (Object) client.execute("ms.CreateBlog",params); 
      ArrayList<String> dirListing = new ArrayList<String>(); 
      System.out.println(result.toString());
    } 
    catch (XmlRpcException ex) 
    { 
      System.out.println("Invalid url....."+ex.getMessage());
      ex.printStackTrace(); 
    }
  }
}