Minor update: added footer text to daily emails, show today's date and number of posts in dashboard widget and email, use separate singular and plural strings, compatibility is now WP 4.6-4.7+, updated copyright date (2017), and more

$email = '<strong>2</strong> posts have been published to the site Test Blog on <strong>' . current_time( 'M jS' ) . '</strong> in previous years:';

260

$email .= "\n\n== 2014 ==\n";

261

$email .= "* {$post_title2} : " . get_permalink( $post2 ) . "\n";

262

$email .= "\n\n== 2012 ==\n";

263

$email .= "* {$post_title1} : " . get_permalink( $post1 ) . "\n";

264

265

$this->assertEquals(

266

$email,

267

c2c_YearsAgoToday::get_email_body()

268

);

269

}

270

271

/*

272

* add_user_email_footer()

273

*/

274

275

public function test_add_user_email_footer() {

276

$user_id = $this->factory->user->create();

277

$user_profile_url = get_edit_profile_url( $user_id );

278

$text = <<<HTML

279

Hi!

280

281

282

-------------------------------

283

You received this email because you have opted into receiving a daily email about posts published on this day in years past on the site Test Blog, which is using the Years Ago Today plugin.

284

285

If you wish to discontinue receiving these emails, simply log into the site and visit your profile at {$user_profile_url} to uncheck the checkbox labeled "Email me daily about posts published on this day in years past."

* Adds an explanation about the email to the recipient. Serves to remind

268

* the user why they are receiving the email, what it is about, and how to

269

* stop it.

270

*

271

* @since 1.2

272

*

273

* @param int $user_id The user ID.

274

* @param string $body. The email body.

275

* @return string

276

*/

277

public static function add_user_email_footer( $user_id, $body ) {

278

$body .= "\n\n\n-------------------------------\n";

279

$body .= sprintf(

280

__( 'You received this email because you have opted into receiving a daily email about posts published on this day in years past on the site %s, which is using the Years Ago Today plugin.', 'years-ago-today' ),

281

wp_specialchars_decode( get_option('blogname'), ENT_QUOTES )

282

);

283

$body .= "\n\n";

284

$body .= sprintf(

285

__( 'If you wish to discontinue receiving these emails, simply log into the site and visit your profile at %s to uncheck the checkbox labeled "Email me daily about posts published on this day in years past."', 'years-ago-today' ),

Minor update: added footer text to daily emails, show today's date and number of posts in dashboard widget and email, use separate singular and plural strings, compatibility is now WP 4.6-4.7+, updated copyright date (2017), and more

$email = '<strong>2</strong> posts have been published to the site Test Blog on <strong>' . current_time( 'M jS' ) . '</strong> in previous years:';

260

$email .= "\n\n== 2014 ==\n";

261

$email .= "* {$post_title2} : " . get_permalink( $post2 ) . "\n";

262

$email .= "\n\n== 2012 ==\n";

263

$email .= "* {$post_title1} : " . get_permalink( $post1 ) . "\n";

264

265

$this->assertEquals(

266

$email,

267

c2c_YearsAgoToday::get_email_body()

268

);

269

}

270

271

/*

272

* add_user_email_footer()

273

*/

274

275

public function test_add_user_email_footer() {

276

$user_id = $this->factory->user->create();

277

$user_profile_url = get_edit_profile_url( $user_id );

278

$text = <<<HTML

279

Hi!

280

281

282

-------------------------------

283

You received this email because you have opted into receiving a daily email about posts published on this day in years past on the site Test Blog, which is using the Years Ago Today plugin.

284

285

If you wish to discontinue receiving these emails, simply log into the site and visit your profile at {$user_profile_url} to uncheck the checkbox labeled "Email me daily about posts published on this day in years past."

* Adds an explanation about the email to the recipient. Serves to remind

268

* the user why they are receiving the email, what it is about, and how to

269

* stop it.

270

*

271

* @since 1.2

272

*

273

* @param int $user_id The user ID.

274

* @param string $body. The email body.

275

* @return string

276

*/

277

public static function add_user_email_footer( $user_id, $body ) {

278

$body .= "\n\n\n-------------------------------\n";

279

$body .= sprintf(

280

__( 'You received this email because you have opted into receiving a daily email about posts published on this day in years past on the site %s, which is using the Years Ago Today plugin.', 'years-ago-today' ),

281

wp_specialchars_decode( get_option('blogname'), ENT_QUOTES )

282

);

283

$body .= "\n\n";

284

$body .= sprintf(

285

__( 'If you wish to discontinue receiving these emails, simply log into the site and visit your profile at %s to uncheck the checkbox labeled "Email me daily about posts published on this day in years past."', 'years-ago-today' ),