English (United Kingdom)
Jms Multi Site, formerly joomla multisite.
Create, share multiple joomla sites in few clicks !
Message
  • EU e-Privacy Directive

    This website uses cookies to manage authentication, navigation, and other functions. By using our website, you agree that we can place these types of cookies on your device.

    View e-Privacy Directive Documents

Welcome, Guest
Please Login or Register.    Lost Password?

Certain Users see all public and private templates
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: Certain Users see all public and private templates
#9630
Re: Certain Users see all public and private templates 12 Years, 1 Month ago Karma: 1
i got it done by making a new field for my users that I can assign multiple groups. Then I changed the groupName into an array and made the function in getTemplatesList to read the array and used if(in_array)... to get it done. Works like a charm!

Now I can assign any user to multiple template groups individually.

Buddy
buddyq
Expert Boarder
Posts: 106
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9647
Re: Certain Users see all public and private templates 12 Years, 1 Month ago Karma: 54
So if I understand you correctly, what you did is to allow in the "menu item" relative to the create site, to give the possibility to enter serveral group values and you have modified the getTemplateList filtering to use the array instead of a string.

Perhaps you could send me the code for review and let me see if I could use it in the JMS distribution.
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9658
Re: Certain Users see all public and private templates 12 Years, 1 Month ago Karma: 1
This is what I did to views/slaves/view.php in the frontend

Code:

// $groupName = null; //original code
$groupName = array(); // changed to array by Buddy Q
   
if ( isset( $filters['groupName'])) {
      $groupName[] = $filters['groupName'];
    }
// Start Add by Buddy Q
$user =& JFactory::getUser();
if($user->id){
// Get ALL user fields in case we want to use them.
$db = JFactory::getDBO();

// user_profile table is created and used with ContentBuilder component :: crosstec.de
$query = "SELECT *"
. " FROM #__user_profile"
. " WHERE user_id = ".$user->id
. " LIMIT 1"
;
$db->setQuery($query);
$userInfoRows = $db->loadObjectList();
  }
foreach ($userInfoRows as $key=>$object){
if($object->template_groups){
// Get the originally selected groupName set in Multisites and merge with groups set in user field called 'template_groups'
$groupName = array_merge( $groupName, explode( "," , str_replace(" ","", $object->template_groups)));
}
}
// End add by Buddy Q




Then in admin/components/com_multisites/helpers/helper.php

Changed line: 393 to:
Code:

else if ( in_array($groupName, $filter_GroupName)) {


That's it. Not too hard and really nice!

Buddy
buddyq
Expert Boarder
Posts: 106
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9665
Re: Certain Users see all public and private templates 12 Years, 1 Month ago Karma: 54
Thank you for the info.
This is a code that can only works on Joomla 1.7 or 2.5 as it uses specific MySQL table present in joomla 1.7 or 2.5.
It is not compatible with Joomla 1.5.
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9672
Re: Certain Users see all public and private templates 12 Years, 1 Month ago Karma: 1
I am running Joomla 1.5.25 and this works.

The specific table #__user_profile, like I stated, is created by the component ContentBuilder which is a cck component and allows you to extend the user registration and profile fields. I am using that table to fetch my comma delimited groups from a textfield I called "template_groups".
buddyq
Expert Boarder
Posts: 106
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9681
Re: Certain Users see all public and private templates 12 Years, 1 Month ago Karma: 54
This is effectivelly specific.
For your information, I have updated the helper to force using an firterGroupName as an array.
So that your specific code is just present in one file as the other one is included in JMS core.
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12
get the latest posts directly to your desktop
2Win, Multisite(s) are trademarks of Edwin2Win.
Joomla