duanhan5230 2013-01-14 12:45
浏览 388
已采纳

在回复中仅向邮件主题添加一个“Re:”

I use a Private Message script where it adds a Re: to the message subject upon every reply. Unfortunately, if there are more than one reply to the same message, it adds another Re:, so by the time a few PMs have been exchanged, it looks like this:

Re: Re: Re: Re: Re: Re: Re: Re: Hello World!

Here are the relevant parts of the script that does this:

                    | <a class="reply"
                    href="<?php echo wp_nonce_url( "?page=rwpm_send&recipient=$msg->sender&id=$msg->id&subject=Re: " . stripcslashes( $msg->subject ), 'rwpm-reply_inbox_msg_' . $msg->id ); ?>"><?php _e( 'Reply', 'pm4wp' ); ?></a>

So I want to adjust the script so that it only adds one Re: if there is a reply. How do I do that? I am guessing maybe an IF statement checking if there is already a Re: there or not...

  • 写回答

2条回答 默认 最新

  • dongshou1856 2013-01-14 12:50
    关注

    So, add the "Re: " only if there is no:

    | <a class="reply" href="<?php echo wp_nonce_url( "?page=rwpm_send&recipient=$msg->sender&id=$msg->id&subject=".(strpos($msg->subject, "Re:") === false ? "Re: " : ""). stripcslashes( $msg->subject ), 'rwpm-reply_inbox_msg_' . $msg->id ); ?>"><?php _e( 'Reply', 'pm4wp' ); ?></a>
    

    And, when it only should stay on the beginning:

       | <a class="reply" href="<?php echo wp_nonce_url( "?page=rwpm_send&recipient=$msg->sender&id=$msg->id&subject=".(substr($msg->subject, 0, 3) != "Re:" ? "Re: " : ""). stripcslashes( $msg->subject ), 'rwpm-reply_inbox_msg_' . $msg->id ); ?>"><?php _e( 'Reply', 'pm4wp' ); ?></a>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作