How can i add mp3 files from all the site instead of only one user now ?

By Babeth

Hello,

I'm french and i'm customize an Elgg.

I added a plugin widget to play all mp3 i upload in File. It's working perfectly, but only for all the mp3s uploaded in File BY ONE SINGLE USER : the user who take the plugin on his profile.

What i want is to have the same plugin which could play all the mp3s added in File, from all users.

I hope you understand what i'm saying.

The code seems simple (for someone who wants to help me, cause for me it's just undescriptible code).

 

   //the page owner
   $owner = $vars['entity']->owner_guid;
   //The maximum mp3 files on playlist    
   $number = 100;
   $playlist = "";
   $titles = "";
    
   //get the user's files
   $files = get_user_objects($vars['entity']->owner_guid, "file", $number, 0);

   //if there are some files, go get them
   if ($files)
   {
      //display in list mode
        foreach($files as $f) {
            $mime = $f->mimetype;
            if (file_get_general_file_type($mime) == "audio") {
                if ($playlist) {
                    $playlist = $playlist . '|';
                    $titles = $titles . '|';
                }
                $playlist = $playlist . $vars['url'] . 'action/file/download?file_guid=' . $f->guid;
                $titles = $titles . $f->title;
            }
        }
    }
    else
    {
        echo elgg_echo("No Files");
    }

 

 

 

Can someone explain me this code and explain me what i have to change to get what i want please ?

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking