Keyword

K2 Item Edit hack to show just the user's folder when browsing

  • carmiaca
  • carmiaca's Avatar Topic Author
  • Offline
  • New Member
More
13 years 5 months ago #95568 by carmiaca
In the item editing window when you click Browse Server on the Image tab it takes you to the default images folder set in Global Configurations in Joomla! so you see all the folders on the server. I didn't want the user to be able to select another user's content, so after a good deal of sleuthing I came up with this hack:

Open the administrator/components/com_k2/views/item/tmpl/filebrowser.php

On about line 12, under the restricted access and within the PHP tags put this to grab the user id:

$user =& JFactory::getUser();$userid=$user->id;

 

Then at around line 32, under if(count($this->folders)): and still within the php tags put:

  if($this->path==$this->parent){//root folder of the images path            $this->folders=array($userid);//reduce folder array to just the user's folder   }

What it does is see if you are at the root images path and, if so, the folder array is changed so it contains only the user's folder.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum