[drupal-devel] [feature] Add path user/{uid}/content to get a listing of one user's nodes

Dries drupal-devel at drupal.org
Fri May 6 18:10:15 UTC 2005


Issue status update for http://drupal.org/node/22183

 Project:      Drupal
 Version:      cvs
 Component:    base system
 Category:     feature requests
 Priority:     normal
 Assigned to:  robertDouglass
 Reported by:  robertDouglass
 Updated by:   Dries
 Status:       patch

There are at least /4 formats/:



The teaser format (titles + author + teasers)
The tracker format (titles + author)
The block format (titles only)
The RSS format

There are at least /3 filter mechanisms/:



Filter by node type
Filter by category
Filter by user

So how about this format:


http://example.com/$format/$filter/


Examples:



teaser -- shows all posts in teaser-format
teaser/type/blog -- shows all blogs in teaser-format
teaser/user/ -- shows all posts from user 
teaser/category/ -- show all posts in category  in teaser-format
...
track -- show all posts in tracker-format
track/type/blog -- show all blogs in tracker-format
track/category/ -- show all posts in category  in tracker-format
...
rss/category/ -- show all posts in category  in rss format
...
or even



rss/type/blog,forum/category/1+2/user/1,10,100 

What we need:



A function that takes a /filter URI/ as input, and that returns a valid
SQL query
A function that takes a /valid SQL query/ and a /format/ as input, and
that returns a chunk of HTML

Example usage:



format_nodes(query_nodes('/type/blog,forum/category/1+2/user/1,10,100'),
'rss')

  Want to create a block with a user's last forum topics?  Create a PHP
block with the following snippet:
  print format_nodes(query_nodes('type/forum/user/$user->uid'),
'titles');
 

NOTE: we might have to refine the URL schema and the API but this would
come a long way.




Dries



Previous comments:
------------------------------------------------------------------------

May 6, 2005 - 17:23 : robertDouglass

Attachment: http://drupal.org/files/issues/usernodes.patch.txt (2.27 KB)

This creates a new path user/{uid}/content which functions just like
node, except it returns only one user's nodes. Minimally intrusive.
Hopefully useful. Open to alternate suggestions on the path (should it
be a path in the node module?) and the page title (currently "user
content").




------------------------------------------------------------------------

May 6, 2005 - 17:34 : robertDouglass

Hmmm - not good. If the user doesn't have any nodes the default text for
a new site ("Welcome to your new Drupal-powered website. This message
...") pops up.


Setting to won't fix until I come up with a better solution.




------------------------------------------------------------------------

May 6, 2005 - 17:35 : Dries

Where is it linked from?  How does it look like?  How does this interact
with the tracker?


Seen this: http://flickr.com/photos/factoryjoe/12517114/?




------------------------------------------------------------------------

May 6, 2005 - 18:14 : robertDouglass

Attachment: http://drupal.org/files/issues/usernodes.patch2.txt (2.26 KB)

Ok, this is better. This adds a new function, user_nodes, and two new
paths:
1) user/{uid}/content
2) user/{uid}/content/feed


The first works and looks just like the current q=node path, the second
just like node/feed, both only showing the published content of the user
{uid}.




------------------------------------------------------------------------

May 6, 2005 - 18:15 : robertDouglass

Dries, the tracker module shows a tabular view of basically the same
content. That's useful for tracking, but not for having a "front page"
view of one user's content. Tracker also doesn't offer a user feed,
afaik.




------------------------------------------------------------------------

May 6, 2005 - 18:31 : adrian

How does this differ from blog ?


In that any type of content is shown?  Isn't the idea to turn blog into
an extension of any node (kind of like the new events) ?




------------------------------------------------------------------------

May 6, 2005 - 18:37 : robertDouglass

Yes, you're right, in which case it would make more sense to have this
method in user than rely on blog/{uid}. The blog=anynode solution makes
this functionality dependent on the blog module -my suggestion isn't
dependent on any other module. It lists all of a user's content. Seems
like the right place for a method like this is in the user.module, not
the blog module.







More information about the drupal-devel mailing list