<?php }
add_action( 'show_user_profile', 'show_profile_fields' );
add_action( 'edit_user_profile', 'show_profile_fields' );
//Save User Team option
function save_profile_fields( $user_id ) {
if (!current_user_can('edit_user', $user_id ))
return false;
update_user_meta( $user_id, 'squad', $_POST['squad'] );
update_user_meta( $user_id, 'facility', $_POST['facility'] );
}
add_action( 'personal_options_update', 'save_profile_fields' );
add_action( 'edit_user_profile_update', 'save_profile_fields' );
<?php
add_action( 'show_user_profile', 'show_extra_profile_fields' );
add_action( 'edit_user_profile', 'show_extra_profile_fields' );
function show_extra_profile_fields( $user ) { ?>
<h3>Extra profile information</h3>
<table class="form-table">
<tr>
<th><label for="gender">Пол</label></th>
<td>
<select name="gender" id="gender" >
<option value="Male" <?php selected( 'Male', get_the_author_meta( 'gender', $user->ID ) ); ?>>Мужчина</option>
<option value="Female" <?php selected( 'Female', get_the_author_meta( 'gender', $user->ID ) ); ?>>Женщина</option>
</select>
</td>
</tr>
</table>
<?php }
add_action( 'personal_options_update', 'save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'save_extra_profile_fields' );
function save_extra_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) )
return false;
update_usermeta( $user_id, 'gender', $_POST['gender'] );
}
?>
function tml_redirect_url( $url, $action ) {
if ( 'register' == $action )
$url = 'АДРЕС';
return $url;
}
add_filter( 'tml_redirect_url', 'tml_redirect_url', 10, 2 );
$('.variations_form.cart').before( $('.description-table, .price').clone() )
var form = document.getElementsByClassName('variations_form')[0],
form_container = form.parentElement,
table_copy = form.getElementsByClassName('description-table')[0].cloneNode(true),
span_copy = form.getElementsByClassName('price')[0].cloneNode(true);
form_container.insertBefore(table_copy, form);
form_container.insertBefore(span_copy, form);
get_currentuserinfo()
получает только данные из таблицы wp_users.global $current_user;
get_currentuserinfo();
$gender = get_user_meta( $user_ID, 'gender', true );
var_dump( $gender );
// Либо можно получить все метаданные юзера массивом, и работать уже с ними:
$meta = get_user_meta( $user_ID );
var_dump( $meta );
global $current_user;
echo 'Username: ' . $current_user->user_login . '<br />';
echo 'User email: ' . $current_user->user_email . '<br />';
echo 'User first name: ' . $current_user->user_firstname . '<br />';
echo 'User last name: ' . $current_user->user_lastname . '<br />';
echo 'User display name: ' . $current_user->display_name . '<br />';
echo 'User ID: ' . $current_user->ID;