我有一个自定义插件,可以根据保存的搜索功能发送电子邮件。当我输入一封特定的电子邮件时,该功能似乎起作用,但在浏览个人资料时却不起作用。
代码如下:
function saved_search_send_event_hook($timeslot = \'onceaday\') {
$blogname = get_bloginfo();
global $wpdb;
$users = $wpdb->get_results( "SELECT * FROM $wpdb->users AS u
LEFT JOIN wp_m_membership_relationships AS mmr ON mmr.user_id = u.id
LEFT JOIN wp_m_subscriptions AS s ON mmr.sub_id = s.id
WHERE s.sub_name = \'AnActiveWithMembership\'" );
foreach($users as $user) {
$profiles = erns_saved_search_getprofiles($user->ID, $timeslot);
if(!empty($profiles[\'count\'])) {
// The code works with \'[email protected]\' on this line instead of $user->email
$to = $user->email;
$subject = \'[\' . $blogname . \'] \' . trim(\'Saved Searches\');
}
}
}
我觉得我忽视了这里的一些东西。如果您需要任何其他信息,请告诉我。Wordpress v4。1.