繁体   English   中英

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

[英]Wordpress Multi-Site -Create Users programmatically

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

Wordpress Multi Site (Networking enabled)似乎是一个类似的问题,但我似乎无法实现那里提供的解决方案。 任何人都可以帮助实现这一点的基础知识吗?

您应该在此处使用 wordpress 多站点插件。您只需调用单个方法即可多站点中使用新路径创建新博客。以下是使用 apache xml-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(); 
    }
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM