简体   繁体   English

使Wordpress在内部用户和外部非Wordpress数据库之间进行通信

[英]Making Wordpress communicate between internal users and external non Wordpress database

I come to you because I'm a little bit lost in the implementation of a specific project... 我来找你是因为我在执行特定项目时有些失落...

Here is the configuration of my project: - A Wordpress website - An external database outcome of the ERP "OpenERP", containing a table that contains hundreds of users. 这是我的项目的配置:-一个Wordpress网站-ERP“ OpenERP”的外部数据库结果,其中包含一个包含数百个用户的表。

In the Wordpress site, I need to create a form that will allow visitors to register in the external database. 在Wordpress网站上,我需要创建一个表单,该表单将允许访问者在外部数据库中注册。 I also need the visitor to be registered as a user in the Wordpress website because in the near future, registered users will have access to particular content via Wordpress. 我还需要将访问者注册为Wordpress网站上的用户,因为在不久的将来,注册用户将可以通过Wordpress访问特定内容。

In addition to this, the client wants to continue to add new users via OpenERP. 除此之外,客户端希望继续通过OpenERP添加新用户。 In this case, the new user will also need to be created "immediately" in Wordpress. 在这种情况下,还需要在Wordpress中“立即”创建新用户。

How can I do this? 我怎样才能做到这一点?

Thank you in advance, Cédric 预先感谢您,塞德里克

I looked at "OpenERP" real fast, hoping there is an API. 我真正地快速查看了“ OpenERP”,希望有一个API。 Instead I got confused on the product, just a little. 取而代之的是,我对产品有些困惑。 There are fundamentally a few ways to go, here is the path I would explore : 从根本上讲,有几种方法可以走,这是我探索的路径:

Does "OpenERP" have any type of API for adding and polling users? “ OpenERP”是否具有用于添加和轮询用户的任何类型的API? This is the way to go. 这是要走的路。 So when a new user is registered (created) in WP you can hook the creation via wp_insert_user() see : http://codex.wordpress.org/Function_Reference/wp_insert_user to get started. 因此,当在WP中注册(创建)新用户时,您可以通过wp_insert_user()挂钩创建,请参见: http : wp_insert_user()以开始使用。 The hook would check with OpenERP for a user ("does exist") and create if new to OpenERP. 该钩子将与OpenERP一起检查用户(“确实存在”)并创建OpenERP的新用户。

When OpenERP has a new user created, ideally you can send the details to WP, in any number of ways, to create a new user. 当OpenERP创建了新用户后,理想情况下,您可以通过多种方式将详细信息发送给WP以创建新用户。 Creation of the user can include forced PW creation, random PW, and even welcome emails. 用户的创建可以包括强制PW创建,随机PW甚至欢迎电子邮件。 See wp_create_user via http://codex.wordpress.org/Function_Reference/wp_create_user . 请通过http://codex.wordpress.org/Function_Reference/wp_create_user参阅wp_create_user You could create an API, a hidden method, an adaptor, etc. 您可以创建一个API,一个隐藏方法,一个适配器等。

The unanswered question is "What features are available in OpenERP to talk to a remote site over http or the network?". 未解决的问题是“ OpenERP中可以使用哪些功能通过HTTP或网络与远程站点进行对话?”。 Additionally, what security holes are you opening up and how do these concern the business? 此外,您将打开哪些安全漏洞,这些漏洞与企业有何关系?

Technically, creation of a password and account, in any professional situation, requires secure practices. 从技术上讲,在任何专业情况下创建密码和帐户都需要安全的做法。 SSL/https or possibly SOAP/WSDL to the rescue? 使用SSL / https还是可能使用SOAP / WSDL进行救援?

The bottom line : Wordpress has all of the tools, hooks, and features needed to accomplish your goals. 最重要的一点:WordPress具有完成目标所需的所有工具,挂钩和功能。 What does OpenERP have to allow you to meet these goals? OpenERP必须具备哪些条件才能实现这些目标?

One final concern, you could have a situation of user conflict - a user created in OpenERP and WP. 最后一个问题是,您可能会遇到用户冲突的情况-在OpenERP和WP中创建的用户。 Some extra logic may be needed, as well as a consideration of how you (as the programmer) choose to define what makes a user unique (email can change, making email a junky unique identifier), user names also can change (not in WP). 可能需要一些额外的逻辑,并考虑您(作为程序员)如何选择定义什么来使用户唯一(电子邮件可以更改,使电子邮件成为唯一的唯一标识符),用户名也可以更改(在WP中不可) )。 If these attributes change (edited) you could have heartburn. 如果这些属性发生更改(编辑),您可能会胃灼热。 The entire CRUD cycle needs to be accounted for in detail on both systems. 这两个系统都需要详细说明整个CRUD周期。 A WP ID to OpenERP ID relationship table, with status, will probably become a requirement. 具有状态的WP ID到OpenERP ID的关系表可能会成为必需项。

There are a few other ways to go, but above highlights how I would begin thinking about the problem. 还有其他几种方法,但是上面重点介绍了我将如何开始思考该问题。

Hope this helps. 希望这可以帮助。

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

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