How to give permission to user on their own pods pages content with 'add' and 'edit' options only? I am using PHP, Apache, MySql and wordpress. Please, give me code examples.
I am using following code:
<?php
$object = new Pod('dreams');
$object->ui = array('title' => 'My Pod' ,'add_fields' => array('name' ,'position','photo','bio','eom'),'edit_fields' => array('name' ,'position','photo','bio','eom','approved'));
//load Pod
$pod = new Pod('dreams');
if(current_user_can('administrator')) {
//set publicForm() visible fields for admins
$object->ui = array('title' => 'My Dream' ,'add_fields' => array('name' ,'position','photo','bio','eom'),'edit_fields' => array('name' ,'position','photo','bio','eom','approved'));
pods_ui_manage($object);
} else if(is_user_logged_in()) {
// Get the last URL variable
$slug = pods_url_variable('1');
$Edit = new Pod('team', $slug);
$name = $Edit->get_field('name');
$author_id = $Edit->get_field('author_id'); // GET AUTHOR FROM POD
$user_id = $current_user->ID;
global $current_user; // GET USER INFO
get_currentuserinfo();
$object->ui = array('title' => 'My Dream' ,'add_fields' => array('name' ,'position','photo','bio','eom'),'edit_fields' => array('name' ,'position','photo','bio','eom','approved'));
pods_ui_manage($object);
// $edit_listing = (($author_id == $current_user->ID) || (current_user_can('manage_options') == true) ? true : false); //
}; ?> <br/><br/>
<table>
<div><h1>Create a Dream</h1>
<p>What is this Dream, what do I want to do, accomplish, achieve?</p>
<p>Does this Dream involve someone else?</p>
<p>What tools are available to help achieve this Dream?</p>
<p>What steps can I take to help me achieve this Dream?</p>
<?php $pod->publicForm($fields); ?>
</div></table>
Now the user can also see and edit all other user posts. But this should not be so.
In your "ui" array, you want to add an additional 'where' and 'edit_where' clause.