Good day, I need to create a view, which only shows data related to the user logged in user. When I have a user called "john smith", I create a contents as I like, BUT I don't want other users to see them.
A content can have multiple input from different users, so ONLY admin can see all content. while, each user, can only see his OWN content which he posted him self.
Think of it like a database system, where each student can add projects for his own records, but each student can see ONLY his own.
I tried looking around first, and I came across this question https://stackoverflow.com/questions/20840490/drupal7-filter-view-based-on-current-users-roles which seemed bit related, but I got lost in the too much explanation because they not entirely related to what I want to achieve.
In user roles permission, I perfectly found (add content, edit own content) but its missing one more thing which I want.."view own content"!!
I think it has something to do with filed permission, or something like when adding a content, set its permission to be view my that user only.
In coding the view to show ONLY table rows related to the that user, maybe something like this:
global $user;
if (in_array (student_field_name == $user))
//view the row related to that user;
if (in_array('administrator', $user->uid))
//show ALL data rows available
To summarize, I want the user to be able to SEE his own data only. while admin will be able to see ALL content view of that page.
author
field of a Node is equal to the logged in user. Theauthor
created the content -- nobody else.