سلام و عرض ادب کدها رو به شکل زیر در فایلها زدم اما دیتا به دیتابیس ارسال نمیشه و اطلاعات جدید هم نمایش داده نمیشه ممنون میشم بفرمایید مشکل کجاست؟
فایل menus:
function wp_apis_users_pages(){
global $wpdb;
if(isset($_GET['action']) && $_GET['action']='edit')
{
$userID = intval($_GET['id']);
if(isset($_POST['saveuserinfo'])){
$mobile=$_POST['mobile'];
$wallet=$_POST['wallet'];
if(!empty($mobile)){
update_user_meta($userID , 'mobile' , $mobile);
}
if(!empty($wallet)){
update_user_meta($userID , 'wallet' , $wallet);
}
}
$mobile = get_user_meta($userID , 'mobile' , true);
$wallet = get_user_meta($userID , 'wallet' , true);
include WP_APIS_TPL.'admin/menus/users/edit.php';
return;
}
$users=$wpdb->get_results("SELECT ID,user_email,display_name FROM {$wpdb->users}");
include WP_APIS_TPL.'admin/menus/users/users.php';
}
فایل users:
<div class="wrap">
<h1>کاربران ویژه</h1>
<table class="widefat">
<thead>
<tr>
<th>شناسه</th>
<th>نام کامل</th>
<th>ایمیل</th>
<th>شماره همراه</th>
<th>کیف پول</th>
<th>عملیات</th>
</tr>
</thead>
<tbody>
<?php foreach($users as $user): ?>
<tr>
<td><?php echo $user->ID; ?></td>
<td><?php echo $user->display_name; ?></td>
<td><?php echo $user->user_email; ?></td>
<td><?php echo get_user_meta($user->ID , 'mobile' , true);?></td>
<td><?php echo number_format(get_user_meta($user->ID , 'wallet' , true)).'تومان'?></td>
<td>
<a href="<?php echo add_query_arg(['action' => 'edit' , 'id' => $user->ID]);?>">
<span class="dashicons dashicons-edit"></span>
</a>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
فایل edit:
<div class='wrap'>
<h1>ویرایش اطلاعات کاربران</h1>
<form action="" method="post"></form>
<table class='form-table'>
<tr valign="top">
<th scope="row">شماره همراه</th>
<td>
<input type="text" name="mobile" value="<?php echo $mobile; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">کیف پول</th>
<td>
<input type="text" name="wallet" value="<?php echo $wallet; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"></th>
<td>
<button class="button" type="submit" name="saveuserinfo">ذخیره سازی اطلاعات</button>
</tr>
</table>
</div>