Changeset 1271540
- Timestamp:
- 10/23/2015 06:15:15 AM (10 years ago)
- File:
-
- 1 edited
-
email-mentioned/trunk/email-mentioned.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
email-mentioned/trunk/email-mentioned.php
r1186832 r1271540 1 <?php1 <?php 2 2 /* 3 3 Plugin Name: Email Mentioned 4 Plugin URI: http ://wordpress.org/extend/plugins/XXXXXXXXX4 Plugin URI: https://wordpress.org/plugins/email-mentioned/ 5 5 Description: Send a customizable email to each user mentioned in a comment. The mention character/string is also customizable (for instance @, like in Twitter). 6 Version: 1. 016 Version: 1.1 7 7 Author: Raúl Antón Cuadrado 8 8 Author URI: http://about.me/raulanton … … 80 80 if ( ! function_exists('antonem_sendmail') ) : 81 81 function antonem_sendmail($comment_id, $approval_status=" "){ 82 83 82 84 83 85 //Get customization values … … 102 104 $commenter = get_userdata($comment->user_id)->display_name; 103 105 106 104 107 // Get an array with all the people cited 105 108 $people_mentioned_d = preg_split("/[\s,]+/", $comment->comment_content); 106 109 $people_mentioned = array_unique((preg_grep("/^".$qualifier.".*/", $people_mentioned_d))); 110 107 111 108 112 if (count($people_mentioned)>0){ … … 133 137 134 138 //Send the message to each one mentioned 139 echo "logitud".count($people_mentioned); 135 140 foreach($people_mentioned as $participant_mentioned) 136 141 { 137 $email= get_userdata(antonem_userid_by_displayname(substr($participant_mentioned, 1)))->user_email; 142 143 $email= get_userdata(antonem_userid_by_displayname(substr($participant_mentioned, 1)))->user_email; 138 144 if ($email != "") 139 145 { 140 wp_mail( $email, $the_subject, $the_message);146 wp-email ($email, $the_subject, $the_message); 141 147 } 142 148 } 143 149 144 145 146 150 } 151 exit; 147 152 } 148 153 add_action('comment_post', 'antonem_sendmail'); … … 161 166 162 167 $user_query = new WP_User_Query( array( 163 'meta_key' => 'display_name', 164 'meta_value' => $display_name, 168 169 'search' => $display_name, 170 'search_columns' => array( 'display_name' ), 171 165 172 'fields' => 'ID', 166 173 'number' => 1 … … 168 175 169 176 $ids = $user_query->get_results(); 177 178 170 179 171 180 if (!empty($ids)) { … … 180 189 181 190 } 191 192 193 function add_display_name_to_user_queries( $search_columns, $search, $this ) { 194 $search_columns[] = 'display_name'; 195 return $search_columns; 196 } 197 198 add_filter( 'user_search_columns', 'add_display_name_to_user_queries', 10, 3 ); 182 199 183 200 endif;
Note: See TracChangeset
for help on using the changeset viewer.