Wondered if someone could assist me, I have no PHP knowledge so im struggling a bit. I have installed the following modules
To Do List Module - http开发者_StackOverflow社区://drupal.org/project/to_do View Custom Field - http://drupal.org/project/views_customfield - Field that allows usage of custom PHP code (with access to view's database result)I created a view with the following fields:
User: Uid (excluded from display)
Node: Title
To do list: Deadline
To do list: Priority
To do list: Start date
To do list: Status
To do assigned users: Assigned user ID (excluded from display)
To do list: Buttons (excluded from display)
Customfield: PHP code
The following Tokens/Replacement Patterns are available based on the above fields
* [uid] == User: Uid
* [title] == Node: Title
* [deadline] == To do list: Deadline
* [priority] == To do list: Priority
* [start_date] == To do list: Start date
* [item_status] == To do list: Status
* [uid_field] == To do assigned users: Assigned user ID
* [buttons] == To do list: Buttons
* [phpcode] == Customfield: PHP code
* [markup] == Customfield: Markup
What I would like to accomplish is:
As, the button field has been excluded, I am trying to use the Customfield, to display that button. But only display that button if the current user is the author of the To Do node.
What ive aded to Customfield PHP code
<?php
global $user;
$data->to_do_assigned_users;
if ($user->uid == $data->uid_field)
{
print '[buttons]';
}
?>
What's happening
Nothing displays using the above code.I know the [buttons] token works because when I use the following code, it displays the button.
<?php
print '[buttons]';
?>
So I assume something needs to be added so that the system can decide whether the current logged in user is the author of the node. Both the [UID] & [UID_FIELD] always display the same value if I ouput it, so I thuogh that would work but it doesn't.
Any help would be very much appreciated.
Charles
Any help would be very much appreciated.
Charles
精彩评论