/**
* INICIO DE PERSONALIZACION
*/
add_action(‘after_setup_theme’, ‘remove_admin_bar’);

function remove_admin_bar() {
if (!current_user_can(‘administrator’) && !is_admin()) {
show_admin_bar(false);
}
}

/**
* Call the filter, make it priority 1
*/
add_filter( ‘wpmem_login_redirect’, ‘my_login_redirect’, 1 );

/**
* Function for first-time login redirect
*
* @param $redirect_to
* @return $redirect_to
*/
function my_login_redirect( $redirect_to )
{
/**
* Normally, the redirect process does not require login info as that
* occurs in the login function that the redirect filter is hooking
* into. However, in this case, we have a db flag that is used to
* indicate if this is a first-time login or not. In order to secure
* that process, we need to check login info.
*/

/**
* Get the $user object using the username
*/
$user = sanitize_user( $_POST[‘log’] );
$user = get_user_by( ‘login’, $user );

/**
* Validate the user/pass combination
*/
$pass = wp_check_password($_POST[‘pwd’],$user->user_pass,$user->ID);
if( ! $pass ) {
/**
* If it doesn’t validate, we will just return the unfiltered
* $redirect_to. The login will fail in the login function.
*/
return $redirect_to;
}

/**
* Check for the presence of a flag if the user has logged in before.
*/
$first_login = get_user_meta( $user->ID, ‘first_login’, true );

/**
* If no flag, then set one, and redirect to the password change page
*/
if( ! $first_login ) {

update_user_meta( $user->ID, ‘first_login’, ‘true’, » );

/**
* In setting the redirect url, use the wpmem_chk_qstr function
* to apply the appropriate querystring for displaying password
* change.
*/

$url = ‘/welcome’;

/**
* NOTE: this example assumes that you have set the members-area
* in the plugin settings. if not, use this line instead
* and update for the location of your members-area page:
* $url = ‘http://yoursite.com/members-area-page/?a=pwdchange’;
*/

return $url;

} else {

/**
* If we are here, it’s not a first-time login, so
* no redirect is needed. Return $redirect_to unfiltered.
*
* return $redirect_to;
*/
$url = ‘/campain-manager’;
return $url;
}
}

add_filter(‘frm_encode_subject’, ‘frm_encode_subject’);
function frm_encode_subject(){
return false;
}
/**
* FIN DE PERSONALIZACION
*/