如何让在“编辑”模式下选择的记录与 pod ui 中的视图一致?我正在运行 pod 2.2。如果我在“编辑”模式下连续选择“下一条记录”,则会出现不在视图中的记录。因此,用户可以编辑彼此的记录。请提供代码示例。
<?php
function pods_ui_employees()
{
$icon = '';
add_object_page('Employees', 'Employees', 'read', 'employees', '', $icon);
add_submenu_page('employees', 'Employees', 'Employees', 'read', 'employees', 'employees_page');
}
function employees_page()
{
global $current_user;
get_currentuserinfo();
$object = pods('employees');
$edit_fields = array(
'emp_id',
'first_name',
'last_name',
'manager_id',
'approve'
);
$object->ui = array(
'sort' => 'emp_id ASC',
'limit' => -1,
'where' => 'manager_id="'. $current_user->user_login. '"',
'edit_where' => array('manager_id' => $current_user->user_login),
'title' => 'Employees',
'columns' => array(
'emp_id' => 'Employee ID',
'first_name' => 'First Name',
'last_name' => 'Last Name',
'manager_id' => 'Manager',
'approve' => 'Approve'
),
// 'add_fields' => $add_fields,
'edit_fields' => $edit_fields
);
pods_ui_manage($object);
}
add_action('admin_menu','pods_ui_employees');
?>