Thnaks a lot, Kevin! I ´ll try this.
yesterday I found the way, but isn´t very shinny (i'am not very shinny!! i'am not a developer!):
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ENVIAR MAIL NOTIFICACIÓN POR RUTINA NUEVA O INFORME NUEVO
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
function email_notificacion_informe_rutina() {
//globalizo la bse de datos y el objeto $post para tomar la información que preciso
global $wpdb, $post;
//aca veo el tipo de post y solo aplico la acción si el tipo de post es informes o rutinas
$tipo_post=$post->post_type;
if ($tipo_post !=='post') {
return;
} else {
//tomo el id del usuario con derecho para ver el post (rutina o informe) y que queremos mandar un mail de notificaci´n
$query= "SELECT user_id FROM wp_user2role2object_rs WHERE obj_or_term_id=" . $post->ID;
$userid_rs= $wpdb->get_var($query);
//con el dato anterior (id usuario) tengo el mail del mismo
$usermail_rs = get_the_author_meta('user_email', $userid_rs);
//Luego enviamos el mail$headers='From: My Name';
wp_mail($usermail_rs, "Check our new post!", 'A new post has been published on http://www.YOURBLOGURL.com. ' );
};
}
add_action('publish_post', 'email_notificacion_informe_rutina');
This work for me, but i try your funcion that is the rigth way..
thanks again, and, is there any, i´ll waiting for suggestions
Katarasis