Hi there,

I'm not sure if this is a bug, an intended behaviour from the module or incorrect configuration (or maybe even all 3).

I have a site that's been using Media2 (currently latest Alpha 4) for a little while with some images that have been uploaded into the media root directory (files) prior to installing MBP. Once MBP has been installed, on the MBP Library or MBP My files views on any media fields or on the embed media into WYSIWYG button I am unable to see any of the files uploaded into media prior to the MBP install.

Anything I upload after the MBP install is perfectly viewable, and if I use the traditional "library" or "my files" tabs I can view files that were uploaded both before and after the Media Browser Plus install.

I was wondering if this is how the module is expected to behave as I found it quite counter-intuitive and I could see this being a problem on sites that have been operating for any length of time that would like to use media browser plus as opposed to new builds where this wouldn't really be an issue.

I'm hoping for my own sake I've just done something wrong so any help would be great.

Thanks!

Comments

zuernBernhard’s picture

Same problem here. How to solve it ?

zuernBernhard’s picture

Ok got a little bit further .... Media Browser Plus has a custom view handler (Media Browser Plus Navigation). It extends the View-Query to filter for a certain Media-Folder. The "old" files have no media-folder. Thats why the view does not display them....

... Perhabs its possible to write some kind of "import" assign media folders for existing files.

zuernBernhard’s picture

example.drush.inc

function EXAMPLE_drush_command() {
  $items = array();

  $items['folderize-files'] = array(
    'description' => 'Add Media-Folder (root) to file_enities without folder.',
    'callback' => 'drush_folderize_files'
  );

  return $items;
}

example.module


function drush_EXAMPLE_post_folderize_files() {
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'file');
  $query->entityCondition('bundle', 'image');


  $result = $query->execute();

  $vocab = taxonomy_vocabulary_machine_name_load('media_folders');
  $root_folder = current(taxonomy_get_tree($vocab->vid,0,1));

  foreach ($result['file'] as $record) {

    $my_file = file_load($record->fid);
    $my_file->field_folder[LANGUAGE_NONE][0]['tid'] = $root_folder->tid;

    file_save($my_file);
  }

}
PI_Ron’s picture

@zuernBernhard Did your solution work for you?

zuernBernhard’s picture

Yes that solved the problem for us.

  • das-peter committed 29d6ef9 on 7.x-3.x
    Issue #2395287 by zuernBernhard, JeebsUK: Unable to access files...
das-peter’s picture

I've just extended the filter handling in the related handler (media_browser_plus_views_handler_area_navigation).
Files without folders should now be displayed whenever media root is used.
Would be great if you could test this in your environment. Thanks!

PI_Ron’s picture

@das-peter is this in dev?

das-peter’s picture

@PI_Ron Yes

das-peter’s picture

Status: Active » Fixed

Marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.