This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require( dirname( __FILE__ ) . '/wp_install/wp-blog-header.php' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require( dirname( __FILE__ ) . '/wp-blog-header.php' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create [usermeta] shortcode | |
* | |
* @param $atts An array of attributes | |
* | |
* @return string A single user meta field | |
* | |
* @link https://codex.wordpress.org/Shortcode_API | |
* @link https://codex.wordpress.org/Function_Reference/shortcode_atts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin init | |
* | |
* @link https://codex.wordpress.org/Function_Reference/add_shortcode | |
*/ | |
function wpmu_user_init(){ | |
add_shortcode( 'usermeta', 'wpmu_user_meta_shortcode' ); | |
} | |
add_action( 'init', 'wpmu_user_init' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'personal_options_update', 'wpmu_usermeta_update' ); | |
add_action( 'edit_user_profile_update', 'wpmu_usermeta_update' ); | |
/** | |
* Save user extra meta data | |
* | |
* @param $user_id The user ID of the user being edited | |
* | |
* @link https://developer.wordpress.org/reference/hooks/personal_options_update/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr class="wpmu-user-group"> | |
<th scope="row"><span><?php echo __( 'Music group or singer' ); ?></span></th> | |
<td> | |
<input type="text" list="wpmu_list" name="wpmu[artist]" class="regular-text" value="<?php echo esc_attr( get_user_meta( $user->ID, 'wpmu_artist', true ) ); ?>" /> | |
<datalist id="wpmu_list"> | |
<option value="ACDC" /> | |
<option value="Iron Maiden" /> | |
<option value="Led Zeppelin" /> | |
<option value="Metallica" /> | |
<option value="Megadeth" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr class="wpmu-user-music"> | |
<th scope="row"><span><?php echo __( 'Music genre' ); ?></span></th> | |
<td> | |
<select id="wpmu_music" name="wpmu[music]"> | |
<option value="" <?php selected( esc_attr( get_user_meta( $user->ID, 'wpmu_music', true ) ), '' ); ?>><?php echo __( 'Select music genre' ); ?></option> | |
<option value="Rock" <?php selected( esc_attr( get_user_meta( $user->ID, 'wpmu_music', true ) ), 'Rock' ); ?>><?php echo __( 'Rock' ); ?></option> | |
<option value="Heavy Metal" <?php selected( esc_attr( get_user_meta( $user->ID, 'wpmu_music', true ) ), 'Heavy Metal' ); ?>><?php echo __( 'Heavy Metal' ); ?></option> | |
<option value="Thrash Metal" <?php selected( esc_attr( get_user_meta( $user->ID, 'wpmu_music', true ) ), 'Thrash Metal' ); ?>><?php echo __( 'Thrash Metal' ); ?></option> | |
<option value="Death Metal" <?php selected( esc_attr( get_user_meta( $user->ID, 'wpmu_music', true ) ), 'Death Metal' ); ?>><?php echo __( 'Death Metal' ); ?></option> | |
<option value="Speed Metal" <?php selected( esc_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr class="wpmu-user-guitar"> | |
<th scope="row"><span><?php echo __( 'Play the guitar' ); ?></span></th> | |
<td> | |
<legend class="screen-reader-text"> | |
<span><?php echo __( 'Play the Guitar' ); ?></span> | |
</legend> | |
<div class="wpmu-guitar-checkbox"> | |
<label for="wpmu_guitar"> | |
<input type="checkbox" name="wpmu[guitar]" id="wpmu_guitar" value="Yes" <?php checked( esc_attr( get_user_meta( $user->ID, 'wpmu_guitar', true ) ), 'Yes' ); ?> /> | |
<?php echo __( 'You Play the Guitar on the M.T.V.' ); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr class="wpmu-user-sex"> | |
<th scope="row"><span><?php echo __( 'Sex' ); ?></span></th> | |
<td> | |
<input type="radio" name="wpmu[sex]" id="wpmu_male" value="male" <?php checked( esc_attr( get_user_meta( $user->ID, 'wpmu_sex', true ) ), 'male' ); ?> class="tog" /> <label for="wpmu_male"><?php _e( 'Male' ); ?></label> <br /> | |
<input type="radio" name="wpmu[sex]" id="wpmu_female" value="female" <?php checked( esc_attr( get_user_meta( $user->ID, 'wpmu_sex', true ) ), 'female' ); ?> class="tog" /> <label for="wpmu_female"><?php _e( 'Female' ); ?></label> | |
</td> | |
</tr> |