I am using paid theme of WordPress. The theme is about car dealing. In this theme there is a Role => Dealer
.
When I login as a dealer I can edit my profile (But no Image Option). My client want an upload field for dealer's company logo. I create a media up loader
and its working but not perfectly. When I click on upload logo
button, the media up loader popup, then I select an image, Now the media up loader start processing and some mini seconds it shows me this error:
I search about roles in code and I found this code in parent theme:
add_role('tdp_dealer', 'Vehicle Dealer', array(
'read' => true, // True allows that capability
'edit_dealer_fields' => true
));
Then I search for Upload Capability and found upload_files. I write this cap in the code but its not working.
add_role('tdp_dealer', 'Vehicle Dealer', array(
'read' => true, // True allows that capability
'edit_dealer_fields' => true,
'upload_files' => true,
'edit_posts' => true
));
Then I also try this code but its also not working:
function tdp_add_dealer_caps() {
// gets the author role
$role = get_role( 'tdp_dealer' );
// This only works, because it accesses the class instance.
// would allow the author to edit others' posts for current theme only
//$role->add_cap( 'edit_dealer_fields', true );
$role->add_cap( 'upload_files', true );
}
add_action( 'init', 'tdp_add_dealer_caps');
So guys guide me that how can I upload files, images as a dealer user
. Hope you understand my question.
Try word press plugin in which you can assign permission fr uploading to custom user role:
Members