【问题标题】:Wordpress Multi-Site -Create Users programmaticallyWordpress 多站点 - 以编程方式创建用户
【发布时间】:2012-03-18 01:42:15
【问题描述】:

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

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

【问题讨论】:

    标签: php wordpress api xml-rpc


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-08
      • 1970-01-01
      • 2021-04-05
      相关资源
      最近更新 更多