【问题标题】:Changing text on email notification更改电子邮件通知上的文本
【发布时间】:2013-09-24 15:18:17
【问题描述】:

我正在使用来自 WordPress 的 RSVP 插件并对其进行了修改,以便它可以显示哪些客人被邀请参加哪个活动。当他们进入并回复时,它会发送一封电子邮件,目前看起来像这样:

if((get_option(OPTION_NOTIFY_ON_RSVP) == "Y") && (get_option(OPTION_NOTIFY_EMAIL) != "")) {
    $sql = "SELECT firstName, lastName, rsvpStatus FROM ".ATTENDEES_TABLE." WHERE id= ".$attendeeID;
    $attendee = $wpdb->get_results($sql);
    if(count($attendee) > 0) {
        $body = "Hello, \r\n\r\n";

        $body .= stripslashes($attendee[0]->firstName)." ".stripslashes($attendee[0]->lastName).
                         " has submitted their RSVP and has RSVP'd with '".$attendee[0]->rsvpStatus."'.";

        wp_mail(get_option(OPTION_NOTIFY_EMAIL), "New RSVP Submission", $body);
    }
}

在我的数据库中,我有一个名为 rsvpEvent 的字段,我希望它获取数据并显示此人对该事件的回复。我已尝试将其添加到其中:

if((get_option(OPTION_NOTIFY_ON_RSVP) == "Y") && (get_option(OPTION_NOTIFY_EMAIL) != "")) {
    $sql = "SELECT firstName, lastName, rsvpStatus FROM ".ATTENDEES_TABLE." WHERE id= ".$attendeeID;
    $attendee = $wpdb->get_results($sql);
    if(count($attendee) > 0) {
        $body = "Hello, \r\n\r\n";

        $body .= stripslashes($attendee[0]->firstName)." ".stripslashes($attendee[0]->lastName).
                          "has been invited to '".$attendee[0]->rsvpEvent."'." "and has submitted their RSVP and has RSVP'd with '".$attendee[0]->rsvpStatus."'.";

        wp_mail(get_option(OPTION_NOTIFY_EMAIL), "New RSVP Submission", $body);
    }
}

但是它使我的整个网站崩溃了,谁能给我一些提示或提示我哪里出错了?

【问题讨论】:

  • 使用decent IDE,您会在上传错误代码之前看到语法错误。

标签: php email wordpress


【解决方案1】:

您没有从数据库中获取 rsvpEvent 字段。

尝试将其添加到您的 SELECT 查询中,如下所示:

if((get_option(OPTION_NOTIFY_ON_RSVP) == "Y") && (get_option(OPTION_NOTIFY_EMAIL) != "")) {
    $sql = "SELECT firstName, lastName, rsvpStatus, rsvpEvent FROM ".ATTENDEES_TABLE." WHERE id= ".$attendeeID;
    $attendee = $wpdb->get_results($sql);
    if(count($attendee) > 0) {
        $body = "Hello, \r\n\r\n";

        $body .= stripslashes($attendee[0]->firstName)." ".stripslashes($attendee[0]->lastName).
                          "has been invited to '".$attendee[0]->rsvpEvent."'." "and has submitted their RSVP and has RSVP'd with '".$attendee[0]->rsvpStatus."'.";

        wp_mail(get_option(OPTION_NOTIFY_EMAIL), "New RSVP Submission", $body);
    }
}

【讨论】:

  • 我的错误我忘了添加(一记耳光),是的,我已经尝试并上传了,但仍然出现服务器错误:(
猜你喜欢
  • 2017-09-17
  • 1970-01-01
  • 1970-01-01
  • 2017-05-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-04-04
  • 1970-01-01
相关资源
最近更新 更多