Skip to content

Commit

Permalink
Moving function from #987 into the nominate advancemnet step, trigger…
Browse files Browse the repository at this point in the history
…ing it on all nominations. Also switching it to support a comma seperated field for multiple emails.
  • Loading branch information
AramZS committed Feb 26, 2018
1 parent a1a91d2 commit bcf68bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 9 additions & 0 deletions Controllers/PF_Advancement.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ public function to_nomination( $post = array() ) {
$id = pressforward( 'controller.items' )->insert_post( $post, false, pressforward( 'controller.metas' )->get_post_pf_meta( $orig_post_id, 'item_id' ) );
pf_log( $id );
do_action( 'pf_transition_to_nomination', $id );
$admin_email = get_option( 'pf_nomination_send_email' );
if($admin_email) {
$siteurl = get_option( 'siteurl', '' );
$blogname = get_option( 'blogname', '' );
$pieces = explode(",", $admin_email);
foreach ($admin_email as $email){
wp_mail(trim($email), "New nomination on '".$blogname."'", "A new nomination has been created! Please check it online on " . $siteurl . "/wp-admin/admin.php?page=pf-review");
}
}
return $id;
}

Expand Down
6 changes: 0 additions & 6 deletions includes/nomthis/nominate-this-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,6 @@ function setup_photo_actions() {
$post_ID = intval( $posted );
$pt = get_post_type( $post_ID );
if ( $pt == 'nomination' ) {
$admin_email = get_option( 'pf_nomination_send_email' );
if($admin_email) {
$siteurl = get_option( 'siteurl', '' );
$blogname = get_option( 'blogname', '' );
wp_mail($admin_email, "New nomination on '".$blogname."'", "A new nomination has been created! Please check it online on " . $siteurl . "/wp-admin/admin.php?page=pf-review");
}
?>
<div id="message" class="updated">
<p><strong><?php _e( 'Your nomination has been saved.' ); ?></strong>
Expand Down

0 comments on commit bcf68bf

Please sign in to comment.