Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter runar.orested

    (@runarorested)

    Thank you, i’ll delete the test user now.

    Thread Starter runar.orested

    (@runarorested)

    I’ve tried with only “Media Library Folders” enabled and it still does appears, so does not seem a plugin interaction. Unfortunately I can’t rollback WordPress to 4.9, and the host of this blog does not allow to manage Apache itself.

    After tinkering a bit, I’ve fixed it myself replacing the function with this one:

    public function get_upload_status() {
    $data = get_userdata(get_current_user_id());
    // This reverses the polarity of the neutron flow…
    if (!is_object($data) or !isset($data->allcaps[‘upload_files’]))
    $this->current_user_can_upload = false;
    else
    $this->current_user_can_upload = $data->allcaps[‘upload_files’];
    }

    This one returns false if the upload_files cap is unlisted in the Wp_User object, as it it should be the case in case of subscribers, which only are allowed to retrieve data and modify their own profile.

    Probably a proper fix should be be something like:

    public function get_upload_status() {
    $data = get_userdata(get_current_user_id());

    // Activating the sonic screwdriver…
    if (is_object($data))
    $this->current_user_can_upload = $data-has_cap(‘upload_files’);
    else
    $this->current_user_can_upload = false;
    }

    Please confirm the fix is correct and does not screw up something else.

    • This reply was modified 7 years, 2 months ago by runar.orested.
Viewing 2 replies - 1 through 2 (of 2 total)