View fields & Views Custom Field & Author of node

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by charles.holtzkampf on October 31, 2010 at 1:20pm

Hi All,

This is a two part questions:

  1. The function im after & wheter its possible with views out of the box
  2. If not possible with views out of the box, I found a module that provides this function, but I need some help with php code.

[Part 1]
Wondered if anyone can tell me whether the following is possible within views.

I have installed To do module - http://drupal.org/project/to_do I then created my own view which lists all the tasks created in a particular Organic Group, which works lovely.

One of the fields ive added is the 'to do button field' which gives the user the ability to mark a task as finished from the view listing.

That view is then dislplayed when a group is viewed, so that all users part of that group can see the tasks. The problem I have is that all users part of that group can also see that button & has the ability to mark the task as finished.

Is there a way I can use views to only show that button if the current logged in user is the author of that node( to do task).

If there is another way to achieve this by not having to install the view custom field module, then that would help.

[Part2]

I would like to show / hide certain fields in my Drupal view based on whether the current user is the author of the node being viewed.

I installed the Views Custom Field module which seems to allow this, but I dont have a clue when it comes to php coding. I have tried, but I must be going wrong somewhere.

What I have done so far is:
1. Created the view
2. Added the appropraite filters to only show tasks created in that group
3. Added fields, including the "to do list: Buttons" field

Next thing I want to achieve is to hide the "to do list: Buttons" field ,from appearing if the current logged in user, is not the author.

Here is my phpcode (no laughing). Im not even sure that the field name is for "to do list: Buttons" field.

<?php
global $user;
$data->to_do;
if (
$user->uid == $data->uid)
{
print
'[field_mark_premissions]';
}
?>

thanks in advance for any help

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /