Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » WordPress »

Sobre-escribir wp_new_user_notification()

Estas en el tema de Sobre-escribir wp_new_user_notification() en el foro de WordPress en Foros del Web. Hola, he intentado sin éxito sobre-escribir la función wp_new_user_notification() per sin ningún resultado.. He echo un plugin.. Código PHP: if ( ! function_exists ( 'wp_new_user_notification' ) ) { function  ...
  #1 (permalink)  
Antiguo 05/05/2015, 08:53
 
Fecha de Ingreso: junio-2010
Mensajes: 353
Antigüedad: 13 años, 10 meses
Puntos: 6
Sobre-escribir wp_new_user_notification()

Hola,
he intentado sin éxito sobre-escribir la función wp_new_user_notification() per sin ningún resultado..

He echo un plugin..
Código PHP:
if ( !function_exists('wp_new_user_notification') ) {
function 
wp_new_user_notification($user_id$plaintext_pass ''){}


En functions.php

Código PHP:
if ( !function_exists('wp_new_user_notification') ) {
function 
wp_new_user_notification($user_id$plaintext_pass ''){}


En functions.php

Código PHP:
function new_user_notification($user_id$plaintext_pass ''){}

add_action'wp_new_user_notification',           'new_user_notification' ); 
Pero nada ninguna de las dos manera me ha funcionado en wp 4.1.1

gracias de antemano
  #2 (permalink)  
Antiguo 05/05/2015, 10:19
Avatar de zanguanga
Moderadora
 
Fecha de Ingreso: julio-2009
Ubicación: España
Mensajes: 1.686
Antigüedad: 14 años, 9 meses
Puntos: 429
Respuesta: Sobre-escribir wp_new_user_notification()

Solo pueden sobreescribirse funciones "pluggables" desde un plugin, nunca desde un tema.

Quizá tu plugin tenga algún problema, si quieres ayuda será mejor que pegues el código completo.
__________________
Mi blog personal | Mi G+
  #3 (permalink)  
Antiguo 06/05/2015, 03:30
 
Fecha de Ingreso: junio-2010
Mensajes: 353
Antigüedad: 13 años, 10 meses
Puntos: 6
Respuesta: Sobre-escribir wp_new_user_notification()

Ok, aquí está.

Código PHP:
<?php
/**
 * Plugin Name: Custom New User Notifications
 * Description: Customize the "New User Registration" and "Your username and password" notifications
 * Version: 1.0
 * Author: Tabutnas
 * Author URI: http://magictree.es
 */


if ( !function_exists('wp_new_user_notification') ) {
function 
wp_new_user_notification($user_id$plaintext_pass ''){
     
$user = new WP_User($user_id);

    
$user_login stripslashes($user->user_login);
    
$user_email stripslashes($user->user_email);

    
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
    // we want to reverse this for the plain text arena of emails.
    
$blogname wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

    
$message  sprintf('Nuevo usuario registrado en Área Clientes:'$blogname) . "\r\n\r\n";
    
$message .= sprintf('Nombre del usuario: %s'$user_login) . "\r\n\r\n";
    
$message .= sprintf('Correo electrónico: %s'$user_email) . "\r\n";

        
$cabeceras 'MIME-Version: 1.0' "\r\n";
        
$cabeceras .= 'Content-type: text/html; charset=UTF-8' "\r\n";
// Cabeceras adicionales
        
$cabeceras .= 'From: Àrea clients | Área clientes <[email protected]>' "\r\n";
        
    
wp_mail($user_email'Accés Àrea Clients | Acceso Área Clientes @Sant Cugat Business Park'$message$cabeceras );

}
}

?>
grache =d

Etiquetas: php, plugin, tema
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:24.