Php 向Wordpress中未注册的用户发送激活链接

Php 向Wordpress中未注册的用户发送激活链接,php,plugins,wordpress,contact-form,Php,Plugins,Wordpress,Contact Form,我有一个前端投递表-我使用的是联系表7 数据保存为post,状态为“待定” 我想向用户发送一封电子邮件,其中将有激活链接,以将状态从“待定”更改为“已发布”。用户未注册!我想保持这样 我搜索了很多解决方案,但我只找到了向注册用户发送邮件的插件 我在网上找到一个代码,但它不完整: $unique = md5( $post->post_content ); add_post_meta( $post->ID, '_auto_publish', $unique ); // link to

我有一个前端投递表-我使用的是联系表7

数据保存为post,状态为“待定”

我想向用户发送一封电子邮件,其中将有激活链接,以将状态从“待定”更改为“已发布”。用户未注册!我想保持这样

我搜索了很多解决方案,但我只找到了向注册用户发送邮件的插件

我在网上找到一个代码,但它不完整:

$unique = md5( $post->post_content );
add_post_meta( $post->ID, '_auto_publish', $unique );

// link to be sent
$link = get_permalink( $post->ID );
$link = add_query_arg(
array(
    'autopublish' => $unique,
    'pid'         => $post->ID
),
$link
);

if ( isset ( $_GET[ 'autopublish' ] )
and isset ( $_GET[ 'pid' ] )
and is_numeric( $_GET[ 'pid' ] )
and $post = get_post( $_GET[ 'pid' ] )
and $_GET[ 'autopublish' ] === get_post_meta( $post->ID, '_auto_publish', TRUE )
)
{
$post->post_status = 'publish';
wp_update_post( $post );
delete_post_meta( $post->ID, '_auto_publish' );
}
这应该作为插件实现。你觉得这行吗?我想测试它,但无法输入 打印$link 发送到CF7自动回复邮件


有没有更好的解决办法。请记住,提交表单的用户不是注册成员

您可以做的是,当用户提交表单时,您可以生成一个唯一的随机代码,并将该唯一的随机代码与该特定条目一起存储在表中。然后用那个唯一的随机代码生成URL,并将该URL发送到用户邮箱,当用户单击并登录到那个特定页面时,注册他。就这么简单。你不会为此准备好代码。有更详细的指导吗?你有五个或类似的个人资料吗?请解释
细节
,根据这个定义,我会帮助你。好的,谢谢,我们会联系你的!需要先了解详细信息:)但很高兴知道这是可能的。我现在创建了一个自定义函数,它生成一个随机字符串。将其作为隐藏字段包含在表单中。例如,我现在有一个链接mydomain.com/0jfs0jf2fj09。。困在这里,如何继续?我应该使用我在问题中发布的代码吗?