Skip to content

Instantly share code, notes, and snippets.

@diegoliv
Created May 6, 2014 15:46
Show Gist options
  • Save diegoliv/187fe0e3a7b78b888193 to your computer and use it in GitHub Desktop.
Save diegoliv/187fe0e3a7b78b888193 to your computer and use it in GitHub Desktop.
Código para alterar o texto do e-mail com link de confirmação. Funciona na maioria das vezes, porém em alguns casos resultou em links de ativação sem a chave de acesso ("?key="). O que pode estar causando esse problema?
<?php
function bp_change_activation_mail_text( $message ) {
// Get some globals
global $bp, $wpdb;
// Get username from the signup form just posted
$username = $bp->signup->username;
// SQL query to get activation key for that username
$sql = 'select meta_value from wp_usermeta where meta_key="activation_key" and user_id in ( select ID from wp_users where user_login="' . $username . '" and user_status=2 )';
// Getting the activation key from the database
$activation_key = $wpdb->get_var($sql);
$activate_url = bp_get_activation_page() ."?key=$activation_key";
$activate_url = esc_url( $activate_url );
// Custom message with activation key
$message = "Obrigado por registrar-se no Espaço Tesla!\n\n Para completar a ativação de sua conta, por favor, clique no link abaixo:\n\n$activate_url\n\n";
return $message;
}
add_filter( 'bp_core_signup_send_validation_email_message', 'bp_change_activation_mail_text' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment