A User Facing Content Management View

Drupal does not have user facing content management out of the box. Fortunately, a user facing content management page can be created in 5 minutes using Views. It's not a panacea, but can provide part of the solution.

User Content Management View

I typically use this view in conjunction with a menu block. The menu block has visibility set by role and contains links useful to the user, such as a link to this view, the content creation URL (node/add/foo), and the user's profile.

Basic Content Listing View

The view above was created with Views in Drupal 5 using the settings that follow. Although I haven't created this view in Drupal 6 with Views 2, all of the required fields and options appear to exist. For the example, the story node type is used for blogging.

Access: Set to the appropriate role(s)

Page View with View Type: Table View

URL: Whatever makes sense in your situation

Fields:

Field NameLabelSetting
Node: Title Title As link
Node: Author Name Author None
Node: Created Time Created As Custom Date "M j, Y"
Comment: Count # Cmnts Normal
Comment: Last Comment Time Last Cmnt As Custom Date "M j, Y"
Node: View Link View None
Node: Edit Link Edit Return to View
Node: Delete Link Delete Return to View
View Fields

Filters:
Node: Type "Is One Of" Story
Node: Author is Current User

Sort Criteria
Node: Created Time w/Order: Descending

Variations

The author field was shown for the purposes of example. If the view was truly intended for only the logged in user it is not required.

Removing the "Node: Author is Current User" filter provides a general purpose view. The Edit and Delete links are only displayed if the current user has the ability to edit or delete the node. This is useful for administrators and group blogs.

Using the content type as an argument you can create a general view that handles different content types.

Using the Comment: Count field with "With New Count" provides a quick way to show unviewed comments.

A link to the node creation page can be placed in the header so all of the CRUD functions (create/read/update/delete) are present on the page.

View Export

Also attached is an export of the View I used for this article. Remember, this is PHP. Please review the code before importing it!

Comments

Interesting and useful. Does this solve the drupal problem of not being able to enable 'administer nodes' for fear of providing too many admin options to end users?

I did a small web site for a friend's non-profit and I am trying to find a way to provide her with the ability to edit nodes that were created without giving full admin permissions. Will this view help?

If I understand your question correctly, as long as your access control is working the way you want it to this view is a solution. Whether it's the best solution will depend on your use case.

If you need an access control solution this isn't your answer. The View is display only and doesn't modify access. If the user doesn't have access to a node, the Edit and Delete links will not appear. And even if they did, the user would get an error if they clicked on them.

I do something very similar. I set the node type as an argument, with 'summary, sorted ascending' selected. This way the user is first presented with links to each node type, and then is presented with the listing by node type. It is also very handy to be able to use the links to each node type directly.

@Roger, I could see that being quite useful for a sidebar block. Thanks. Summary is one of those great options I keep re-discovering.

This is a great post. I have a similar view for our member contributors in a user dashboard we made. Yours is a bit more compact and done in D6- Views2. Nice job.

Greg,
we would appreciate if you could explain your approach.

Cheers.

This was great, just what I was looking for!! Thanks!!

Thanks for the article and it helps a lot. I ran into another issue that close. I am having one user create content for certain user and have a select field with list of users. I like to have a view that would show only current user data showing for that field not the author because author would be the same on all the articles.

any help would be good.

Based on your description, I'm not sure if your content node has a field that will allow you to filter on the real author. If it doesn't, I'm not aware of any method for creating a View.

If you do have such a field, there's hopefully some way of mapping it's value to the actual user name of the real author (ideally, the field value would be the real authors user id).

If both the above are true, you could create an argument to filter on the real-author field and use PHP to fill in the value of the argument.

after reading and research I want to do the agruement route and basically have it where it will take the current logging in user and filter one of my view fields and only show the current users results.

That was really a nice piece of information. Thanks for this post.