Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
- add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
- function my_show_extra_profile_fields( $user ) { ?>
- <h3>Adsense Informacije</h3>
- <table class="form-table">
- <tr>
- <th><label for="adsense_336">Adsense 300x250</label></th>
- <td>
- <textarea rows="10" cols="60" name="adsense_336" id="adsense_336" class="regular-text" value="<?php echo esc_attr( get_the_author_meta( 'adsense_336', $user->ID ) ); ?>" ></textarea><br />
- <span class="description">Unesite vas Adsense kod ovde 300x250</span>
- </td>
- </tr>
- <tr>
- <th><label for="adsense_2">Adsense 200x90</label></th>
- <td>
- <textarea rows="10" cols="60" name="adsense_2" id="adsense_2" class="regular-text" value="<?php echo esc_attr( get_the_author_meta( 'adsense_2', $user->ID ) ); ?>" ></textarea><br />
- <span class="description">Unesite vas Adsense kod ovde 200x90</span>
- </td>
- </tr>
- </table>
- <?php }
- add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
- add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
- function my_save_extra_profile_fields( $user_id ) {
- $saved = false;
- if ( current_user_can( 'edit_user', $user_id ) ) {
- update_user_meta( $user_id, 'adsense_336', $_POST['adsense_336'] );
- update_user_meta( $user_id, 'adsense_2', $_POST['adsense_2'] );
- $saved = true;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement