我有一个部分完成的WP插件,集成了轻松!约会调度实用程序到WP数据库。我需要把轻松的约会用户和WP用户联系起来。
结构:
轻松!约会数据库是mysql中WP数据库结构的一部分。简单!约会是在Codeigniter框架中构建的。简单!约会在WP内的iframe中运行。
在轻松!约会中,用户表是ea_users,我知道我需要在ea用户表中为wp_id创建另一列。所以,我会创建这个专栏。
ALTER TABLE `ea_users` ADD `wp_id` BIGINT(20) NOT NULL ;在wp_users表中,我需要id和user_email字段分别与ea_users表中的wp_id和email字段相关联。
这能在mysql中用某种类型的关联来完成吗?(那就太好了)
还是需要一些php代码(在sudo代码中):
On creating an E!A booking, check if the `wp_id` column for the user is null
if is null: Get the the `wp_users` table, `user_email` and current `id` and fill the `ea_users` table `wp_id` and `email`.
else: check for matching `wp_users` `id` and `ea_users` `wp_id`
if yes: match `ea_users` `wp_id` user with `wp_users` `id` and fill existing EA user data in to EA fields
if no: delete the `ea_users` `wp_id` and get the `wp_users` table, `user_email` and fill the `ea_users` table `wp_id` and `email`.如果我必须做PHP,那么我认为这就可以做到。如果我的逻辑不正常请告诉我。此外,我必须记住如何做到这一点,这样任何快速的指针都会受到赞赏,但并不是预期的。
问题:
发布于 2015-12-11 18:16:36
对问题1的答复是否定的。
对第二个问题的回答是,我认为我的逻辑没问题。
对问题3的回答是肯定的,有一些是在WP函数中内置的,我需要的是wp_get_current_user()和get_current_user_id()。
所以,这个问题的大部分都得到了答案。我现在有关于代码点火器集成的问题。
https://stackoverflow.com/questions/34187941
复制相似问题