Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

We are building a site that will have 10-15 photographers posting content. There will be a common blog + each admin has their own portfolio to manage. "Portfolio galleries" and "portfolio pages" are two custom types and they are categorized using "Artist", a custom taxonomy.

We would like all admins:

  1. to be able to see all blog posts
  2. be able to post in the blog
  3. be able to add new "portfolio galleries" and "portfolio pages" and have them automatically tagged with the "artist" taxonomy with the same value as their name (i.e. John Smith will be able to only create portfolio pages and galleries automatically tagged with *Artist = "John Smith"*)
  4. be able to only view portfolio pages and galleries that belong to them (i.e. John Smith will only see portfolio pages and galleries that are marked with *Artist = "John Smith"*)

Finally we would also like to have a couple of "super admins" that will have access to every post on the site.

Any ideas on how to go building something like this? Is it even feasible?


EDIT Following @בניית אתרים suggestion I have read a bit more about Roles and Capabilities and realized that Wordpress already supports out of the box the ability to limit users from editing other people's posts. All I needed to do was to switch all the users to be Authors instead of Editors.

In brief #1, #2 and #4 from the above list are resolved. I still need to get #3 to work using save_post.

share|improve this question

2 Answers 2

Short: yes you can do that.

to be able to see all blog posts

the default editor role can manage to see all posts

be able to post in the blog

again the default editor role can manage to see all posts

be able to add new "portfolio galleries" and "portfolio pages" and have them automatically tagged with > the "artist" taxonomy with the same value as their name (i.e. John Smith).

For that you can use the save_post hook and automatically add there username as taxonomy.

be able to only view portfolio pages and galleries that belong to them (i.e. John Smith will only see > portfolio pages and galleries that are marked with Artist = "John Smith")

when registering post types you can define capabilities for that post type and you need to define edit_others_posts as false, also make sure that your post type supports author.

Finally we would also like to have a couple of "super admins" that will have access to every post on the site.

the default admin role is your friend in this case. basically most of your issues are with Roles and Capabilities

hope this helps

share|improve this answer
    
Thanks for your answer. Very thorough and very interesting. I am not sure how to use the save_post hook. Is there any example of how to do it online? I searched in the WP docs and the page for save_post hook is missing. –  Francesco Gallarotti Feb 21 '11 at 23:56
    
Like you said, I was able to limit access to their own posts only by switching all the users to be "authors" instead of "editors". Makes sense. Still working on the idea of hooking into the save_post to add custom taxonomies on save. –  Francesco Gallarotti Feb 22 '11 at 1:36

If I will be the one building that site, this is what I'll do for the "View Portfolio Pages and Galleries that belong to them":

1.) I'll create a new page template, say template-portfolio.php inside your themes directory, that goes something like this:

<?php
/*
Template Name: Portfolio
*/
if(is_user_logged_in() && current_user_can('manage_options'))  //ensure that it is an admin, as per requirements
{
   global $current_user;
   get_currentuserinfo(); //information shall be stored in $current_user
   // echo 'User ID: ' . $current_user->ID . "\n";

   query_posts(array('Artists' => $current_user->display_name));

    //do the loop here.

}
else
{
  wp_redirect(get_bloginfo('url')); //go to home page if not logged in or if not admin
}
?>

2.) I would create a Page in wordpress and assign Portfolio as the Page Template

3.) I would view the Page using page preview, and if it works, I'll pat myself in the back ;)

You can do a variant of the flow here for your other concerns.

share|improve this answer
    
Not sure that's what he asked. –  Bainternet Feb 16 '11 at 8:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.