Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'show_user_profile', 'display_user_detail_user_meta' );
- add_action( 'edit_user_profile', 'display_user_detail_user_meta' );
- function display_user_detail_user_meta ( $user ) { ?>
- <h3>سایر اطلاعات کاربر</h3>
- <table class="form-table">
- <tr>
- <th><label>کد ملی</label></th>
- <td><input id="unatinalcode" type="text" value="<?php echo get_user_meta( $user->ID, 'unatinalcode', true ); ?>" class="regular-text" /> </td>
- </tr>
- <tr>
- <th><label>استان</label></th>
- <td><input name="uostan" type="text" value="<?php echo get_user_meta( $user->ID, 'uostan', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th><label>شهر</label></th>
- <td><input name="ucity" type="text" value="<?php echo get_user_meta( $user->ID, 'ucity', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th><label>آدرس</label></th>
- <td><input id="uaddress" type="text" value="<?php echo get_user_meta( $user->ID, 'uaddress', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th><label>شماره تماس</label></th>
- <td><input id="umobile" type="text" value="<?php echo get_user_meta( $user->ID, 'umobile', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th><label>شماره موبایل</label></th>
- <td><input id="utel" type="text" value="<?php echo get_user_meta( $user->ID, 'utel', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th><label>نام مدیر</label></th>
- <td><input id="umanagername" type="text" value="<?php echo get_user_meta( $user->ID, 'umanagername', true ); ?>" class="regular-text" /> </td>
- </tr>
- <tr>
- <th><label>شماره مدیر</label></th>
- <td><input id="umanagertel" type="text" value="<?php echo get_user_meta( $user->ID, 'umanagertel', true ); ?>" class="regular-text" /></td>
- </tr>
- </table>
- <h3>اطلاعات فروشنده</h3>
- <table style="width: 100px;" class="form-table">
- <tr>
- <th style="width: 10%;"><label>ردیف</label></th>
- <th style="width: 45%; text-align: right"><label>نام فروشنده</label></th>
- <th style="width: 45%;"><label>شماره تماس فروشنده</label></th>
- </tr>
- <tr>
- <th style="width: 10%;"><label>یک</label></th>
- <td style="width: 45%; text-align: right"><input id="uname1" type="text" value="<?php echo get_user_meta( $user->ID, 'uname1', true ); ?>" class="regular-text" /></td>
- <td style="width: 45%; text-align: right"><input id="utel1" type="text" value="<?php echo get_user_meta( $user->ID, 'utel1', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th style="width: 10%;"><label>دو</label></th>
- <td style="width: 45%; text-align: right"><input id="uname2" type="text" value="<?php echo get_user_meta( $user->ID, 'uname2', true ); ?>" class="regular-text" /></td>
- <td style="width: 45%; text-align: right"><input id="utel2" type="text" value="<?php echo get_user_meta( $user->ID, 'utel2', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th style="width: 10%;"><label>سه</label></th>
- <td style="width: 45%; text-align: right"><input id="uname3" type="text" value="<?php echo get_user_meta( $user->ID, 'uname3', true ); ?>" class="regular-text" /></td>
- <td style="width: 45%; text-align: right"><input id="utel3" type="text" value="<?php echo get_user_meta( $user->ID, 'utel3', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th style="width: 10%;"><label>چهار</label></th>
- <td style="width: 45%; text-align: right"><input id="uname4" type="text" value="<?php echo get_user_meta( $user->ID, 'uname4', true ); ?>" class="regular-text" /></td>
- <td style="width: 45%; text-align: right"><input id="utel4" type="text" value="<?php echo get_user_meta( $user->ID, 'utel4', true ); ?>" class="regular-text" /></td>
- </tr>
- <tr>
- <th style="width: 10%;"><label>پنج</label></th>
- <td style="width: 45%; text-align: right"><input id="uname5" type="text" value="<?php echo get_user_meta( $user->ID, 'uname5', true ); ?>" class="regular-text" /></td>
- <td style="width: 45%; text-align: right"><input id="utel5" type="text" value="<?php echo get_user_meta( $user->ID, 'utel5', true ); ?>" class="regular-text" /></td>
- </tr>
- </table>
- <?php
- // Update if editor is current user
- add_action( 'personal_options_update', 'update_extra_profile_fields' );
- // Update if editor is not current user
- add_action( 'edit_user_profile_update', 'update_extra_profile_fields' );
- function update_extra_profile_fields() {
- $user = wp_get_current_user();
- $userid = $user->ID;
- if ( current_user_can( 'edit_user', $user_id ) )
- update_user_meta( $user_id, 'ucity', $_POST['ucity'] );
- update_user_meta( $user_id, 'uostan', $_POST['uostan'] );
- echo $_POST['ucity'];
- echo $_POST['uostan'];
- }
- }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement