0

How to get records selected in 'edit' mode to agree with view in pods ui? I am running pods 2.2. If I continuously select 'next record' in 'edit' mode, records appear that are not in the view. Users can therefore edit each others' records. Please provide code examples.

<?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');

?>

1 Answers1

0

You can add the 'actions_disabled' option to the $ui options and set it to array( 'navigate' ) to disable the navigation between items.

In Pods 2.3, we've implemented advanced restrictions functionality into edit_where (backwards compatible), among other things.

EDIT (04/17/2013)

There are a number of actions in Pods that the default Pods screens don't enable, using this array as the 'actions_disabled' option will get you what you're wanting:

'actions_disabled' => array( 'navigate', 'view', 'export', 'reorder' )

Other actions available to disable are: 'add', 'edit', 'delete', 'duplicate', 'reorder'.

  • Hi Scott, thanks for the quick response! :-) I added 'disable_actions' => array('navigate'), And it works! But adding disable_action has created Export: CSV TSV XML JSON options at the top of the ui. Any suggestions? – user2073238 Feb 16 '13 at 17:27