After logout browser’s back button into twenty sixteen theme profile

You should use the built in WordPress function is_user_logged_in(), as well as several other WordPress functions: if ( !is_user_logged_in() ) { wp_redirect( get_bloginfo( ‘url’ ) . ‘/index.php’ ); exit; } wp_redirect() handles the redirection for you. Please be aware that it does not exit automatically, so you should call it afterwards. I also built in … Read more

Modify user profile data through scripting?

You should allow for a custom field in your unity profile which will be linked to the WordPress profile. You could then run a JavaScript function to call an AJAX script to execute a PHP file inside WordPress to update a specific profile. Here’s some pseudo-code: JavaScript function updateProfile(parameters) { var xhttp = new XMLHttpRequest(); … Read more

Editable registration date field in user profile

The user_registered field is not in wp_usermeta, but wp_user. You should be using wp_update_user: add_action( ‘show_user_profile’, ‘extra_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘extra_user_profile_fields’ ); function extra_user_profile_fields( $user ) { ?> <h3><?php _e(“Información AbIbBEV”, “blank”); ?></h3> <table class=”form-table”> <tr> <th><label for=”user_registered”><?php _e(“Fecha de ingreso Empleado”); ?></label></th> <td> <input type=”text” name=”user_registered” id=”user_registered” value=”<?php echo esc_attr( get_the_author_meta( ‘user_registered’, $user->ID ) … Read more

Add custom profile field only for site admins?

user_contactmethods filter hook passes two parameters to the registered functions. The second parameter is the WP_User object, with the help of which you can check roles and caps of the edited user. add_filter( ‘user_contactmethods’, ‘se330743_user_contact_methods’, 20, 2 ); function se330743_user_contact_methods( $user_contact, $user ) { // — fields for admins — if ( !in_array(‘administrator’, (array)$user->roles) ) … Read more