Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcard allow on upload types (not download types) #657

Closed
chriscct7 opened this issue Dec 26, 2012 · 5 comments
Closed

Wildcard allow on upload types (not download types) #657

chriscct7 opened this issue Dec 26, 2012 · 5 comments
Milestone

Comments

@chriscct7
Copy link
Member

@chriscct7 chriscct7 commented Dec 26, 2012

I know why we have to list the download types, but on the allowed upload types can we not just feed a wildcard in to allow all upload types. Given we don't want to restrict what they can upload is this a viable option?

@pippinsplugins
Copy link
Member

@pippinsplugins pippinsplugins commented Dec 26, 2012

I don't think WordPress permits a wildcard in that filter.

@chriscct7
Copy link
Member Author

@chriscct7 chriscct7 commented Dec 26, 2012

I've got a better way I think:
Since we're making roles for the staff, we can use a different filter:

/*
* For WP's over 3.4
* For this, see: wp-includes/capabilities.php > map_meta_cap()
*/
function unrestricted_upload_filter($caps, $cap) {
  if ($cap == 'unfiltered_upload') {
    $caps = array();
    $caps[] = $cap;
  }

  return $caps;
}
add_filter('map_meta_cap', 'unrestricted_upload_filter', 0, 2);
/*
* For WP's under 3.4
*/
add_filter( 'user_has_cap', 'unfiltered_upload' );

function unfiltered_upload( $caps )
{
    $caps['unfiltered_upload'] = 1;
    return $caps;
}
@chriscct7
Copy link
Member Author

@chriscct7 chriscct7 commented Dec 26, 2012

Double updated, source: WPSE

@pippinsplugins
Copy link
Member

@pippinsplugins pippinsplugins commented Jan 24, 2013

I don't like the idea of setting this capability globally, but setting it for the new EDD roles we're creating later in #604 sounds like a great idea. Since we're not doing the actual roles for another couple of releases, I'm pushing this back to 1.4.4.

@pippinsplugins
Copy link
Member

@pippinsplugins pippinsplugins commented Feb 7, 2013

I think we can close this now since the shop_manager roles have been given unfiltered upload caps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.