| Server IP : 165.22.154.248 / Your IP : 216.73.217.0 [ Web Server : Apache/2.4.29 (Ubuntu) System : Linux droplet-integra 4.15.0-197-generic #208-Ubuntu SMP Tue Nov 1 17:23:37 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 7.2.24-0ubuntu0.18.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/web-integra/wp-content/plugins/Notificador/ |
Upload File : |
<?php
/*
Plugin Name: Notificador
Plugin URI: https://escueladidactica.com/
Description: Este plugin envia un mensaje al administrador cuando se intenta crea una nueva pagina
Version: 0.9
Author: Jose Gomez - Developer (Escuela Didactica)
Author URI: https://www.escueladidactica.com
License: GPL2
*/
//Envia correo cuando se publica una nueva pagina
add_action( 'publish_page', 'send_mail_admin_publish', 10, 2 );
function send_mail_admin_publish( $ID, $post ) {
$usuario = wp_get_current_user();
$title = $post->post_title;
$permalink = get_permalink( $ID );
$edit = get_edit_post_link( $ID, '' );
$to = "admin@integra.com.co";
$subject = "Notificacion: Nueva pagina publicada";
$message = "El usuario <b>".$usuario->user_login."</b> ha publicado una nueva pagina en su web de wordpress: <b>".$permalink."</b>.";
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( $to, $subject, $message, $headers );
}
add_action( 'pending_page', 'send_mail_admin_pending', 10, 2 );
function send_mail_admin_pending( $ID, $post ) {
$author = $post->post_author; /* Post author ID. */
$name = get_the_author_meta( 'display_name', $author );
$usuario = wp_get_current_user();
$title = $post->post_title;
$permalink = get_permalink( $ID );
$edit = get_edit_post_link( $ID, '' );
$to = "admin@integra.com.co";
$subject = "Notificacion: Nueva pagina pendiente por revision";
$message = "El usuario <b>".$usuario->user_login."</b> ha creado una nueva pagina pendiente por revision en su web de wordpress: <b>".$permalink."</b>.";
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( $to, $subject, $message, $headers );
}
add_action( 'draft_page', 'send_mail_admin_draft', 10, 2 );
function send_mail_admin_draft( $ID, $post ) {
$author = $post->post_author; /* Post author ID. */
$name = get_the_author_meta( 'display_name', $author );
$usuario = wp_get_current_user();
$title = $post->post_title;
$permalink = get_permalink( $ID );
$edit = get_edit_post_link( $ID, '' );
$to = "admin@integra.com.co";
$subject = "Notificacion: Nueva pagina en borrador";
$message = "El usuario <b>".$usuario->user_login."</b> ha creado una nueva pagina y ha sido guardada como borrador en su web de wordpress: <b>".$permalink."</b>.";
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( $to, $subject, $message, $headers );
}
?>