在注册字段中,我引入了另外两个字段,分别使用注册用户的名字和姓氏。在我的woocommerce功能中。php我定义(user\\u firstname/lastname)如下:
function woocommerce_process_registration() {
global $woocommerce, $current_user;
if ( ! empty( $_POST[\'register\'] ) ) {
$woocommerce->verify_nonce( \'register\' );
// Get fields
$user_email = isset( $_POST[\'email\'] ) ? trim( $_POST[\'email\'] ) : \'\';
$password = isset( $_POST[\'password\'] ) ? trim( $_POST[\'password\'] ) : \'\';
$password2 = isset( $_POST[\'password2\'] ) ? trim( $_POST[\'password2\'] ) : \'\';
$user_email = apply_filters( \'user_registration_email\', $user_email );
$user_firstname = isset( $_POST[\'firstname\'] ) ? trim( $_POST[\'firstname\'] ) : \'\';
$user_lastname = isset( $_POST[\'lastname\'] ) ? trim( $_POST[\'lastname\'] ) : \'\';
也就是说,我如何在标题中添加欢迎消息。使用该格式的php,
<?php global $user_identity;
get_currentuserinfo();
if ($user_identity == \'\') {
echo(\'Welcome Guest\');
} else {
echo(\'Welcome \' . $user_identity);
}
?>
提前感谢!