allow s2members to upload files

/**
 * Give s2members upload_files capability
 * All s2members have read capability
 * @param s2member_level6
 */
if ( current_user_can('read') && !current_user_can('upload_files') ) {
    add_action('admin_init', 'allow_s2member_uploads');
}

function allow_s2member_uploads() {
    // global $current_user;
    // $user_roles = $current_user->roles;
    // $user_role = array_shift($user_roles);
    // print $user_role;

    //$contributor = get_role('s2member_level6');
    //$contributor->add_cap('upload_files');
    $current_user -> add_cap('upload_files');
}

Thank you Lawrence and soulsizzle

#wordpress

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s