Hiranthi
Expert
Friendly Neighbour
Member Likes (0)
Hi guys,
Really like the CustomPress plugin, it's 3 plugins in one :) Would like to be able to choose the order of the custom fields though (and combine the fields into blocks, like the More Fields plugin), but this works too :)
Anyway, the reason for this topic: you can provide the name for custom capabilities for the custom post type, but I can't figure out how to use it. I have a custom post type called 'Accounts', filled in 'accounts' in the capability field, but if I add the edit_accounts, delete_accounts and read_accounts capabilities to a role that user doesn't get the menu-items needed to add an account.
I am not using the post capabilities, because I don't want the users to be able to add/edit posts.
Thanks,
Hiranthi

Responses (6)
Member (joined April 2009) Likes (0)
Hiya Hiranthi,
Thanks for your kind words about the CustomPress plugin. It is definitely a powerful tool!
I'm going to ask the developer to respond to your question here as he'll know best about the custom capabilities. This may be related to a capabilities bug that we recently tracked down and should be taken care of in the next version.
Thanks for your feedback. We'll definitely have a look!
Developer (joined August 2010) Likes (0)
@Hiranthi
Grouping of custom fields, ordering, selecting required plus lot more will be introduced in a subsequent release.
You are entering into Mordor here :). Capabilities are hardcore stuff and I have pulled my hair many times while working with them. The safest way is to use the default "post" capability type. If you need to do some more advanced stuff however, you will need to learn more about capabilities.
Start with: http://codex.wordpress.org/Function_Reference/register_post_type , check on the "capability_type" and "capabilities" arguments. Check both the article for 3.0 and 3.1 they both provide bits and pieces. Use http://codex.wordpress.org/Roles_and_Capabilities as a general guide. After you have solid understanding of capabilities proceeed with http://justintadlock.com/archives/2010/07/10/meta-capabilities-for-custom-post-types and http://wordpress.stackexchange.com/questions/1684/what-is-the-use-of-map-meta-cap-filter/2586#2586
Here is a sample function that I use for the Classifieds plugin role and capabilities ( the capability type set for the post type is "classified" singular )
function roles() {global $wp_roles;
if ( $wp_roles ) {
/** @todo remove remove_role */
$wp_roles->remove_role( $this->user_role );
$wp_roles->add_role( $this->user_role, 'Classifieds Member', array(
'publish_classifieds' => true,
'edit_classifieds' => true,
'edit_others_classifieds' => false,
'delete_classifieds' => false,
'delete_others_classifieds' => false,
'read_private_classifieds' => false,
'edit_classified' => true,
'delete_classified' => true,
'read_classified' => true,
'upload_files' => true,
'assign_terms' => true,
'read' => true
) );
/* Set administrator roles */
$wp_roles->add_cap( 'administrator', 'publish_classifieds' );
$wp_roles->add_cap( 'administrator', 'edit_classifieds' );
$wp_roles->add_cap( 'administrator', 'edit_others_classifieds' );
$wp_roles->add_cap( 'administrator', 'delete_classifieds' );
$wp_roles->add_cap( 'administrator', 'delete_others_classifieds' );
$wp_roles->add_cap( 'administrator', 'read_private_classifieds' );
$wp_roles->add_cap( 'administrator', 'edit_classified' );
$wp_roles->add_cap( 'administrator', 'delete_classified' );
$wp_roles->add_cap( 'administrator', 'read_classified' );
$wp_roles->add_cap( 'administrator', 'assign_terms' );
}
}
Good luck :)
Member (joined July 2008) Likes (0)
I do understand about capabilities, also read up on it, but apparently you need to set the capability into single mode and it automatically adds an 's' behind it for the plural capabilities. I've been searching for that info for quite some time (haven't found any documentation that mentions this literally).
Anyway, I read that you shouldn't add the edit_single delete_single and read_single to any role (read Justin Tadlock's post about it). I guess that's where I went wrong.
So, I added capabilities with the extra s behind it (which looks absolutely silly in Dutch, but hey, that's how it works ;-)) and now it works :)
Member (joined March 2011) Likes (0)
is there any timeline on adding a group ability for custom fields?
I really need this in order to easily arrange the information on my classifieds
Thanks
Developer (joined August 2010) Likes (0)
Hi gideonsmolders,
I'll make sure to add this to the next substantial release. I can't give an ETA but I am working on a such release at the moment.
Member (joined March 2011) Likes (0)
Thanks Ivan!
Do you think the number of choices on the field_type can be increased as well
to allow for uploading a set of photos,
add a hyperlink to an external website,
allow for address fields which get automatically added as a googlemap to the post (or in case of classifieds to the ad)
allow for a direct link to flickr, facebook, twitter, linkedin etcetera, which will show a button on the post or ad (the admin can choose the logo)
If you are interested to have more options described, let me know I ahve a whole list
Gideon
Become a member