views:

90

answers:

4

i need to display the contents added by that user...

i have designed a view to display the result.. but it displays the results of all users..... i need to display the contents added by that user...

when i pass the argument of userid it works, but is there any dynamic way to do that....

A: 

Use This

<?php

global $user;
$userId = $user->uid;
?>

You can access all this way

Drupal UserID

streetparade
How is this different from using the "User id from logged in user" option?
Jeremy French
Whenever possible, you should always avoid writing custom php code stored in the db, but should instead use the options provided by views like marcvangend describe.
googletorp
+4  A: 

If all you need is a list of nodes by the current user, the easiest way is to use the User:Current filter. Just click the [+] next to 'Filters', choose 'User:Current' from the list, click the 'Add' button and set the filter to 'Yes'.

The argument-method as described by streetparade (using the 'User: Uid' argument) is useful if you want users to see the list of other users as well. Suppose that your view's url is www.example.com/my-content. If you add a user argument, user #3 could see what user #7 has posted on www.example.com/my-content/7. If you want that, use the argument. If you do not want that, use the filter.

marcvangend
A: 

hey can u help me where to enter this code is this in view... i dont find any this kind of php code in my argment list...

rakesh
A: 

i have done the same addding current user login ID but it doesn't seems to work....

rakesh

related questions