[Solved] Limit a Field to a User Group?

More
12 years 6 months ago - 12 years 6 months ago #33458 by kath
Hi there,

[In short]
Is it possible to limit the display of a FC-field only to a specific Joomla! user group?
(I know about assigning a field to an Access Level, but i need to assign one to a user group instead.)

[In detail]
I want to integrate Akeeba Subscriptions into FLEXIContent in such a way that a certain FC-field (an item-attachment) becomes in-accessible once a user's subscription has expired. And AK Subscriptions uss User groups in that process.

Thank you,
Kath :)
Last edit: 12 years 6 months ago by kath.

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

More
12 years 6 months ago #33460 by brandonking
Hello,

I am going to use Akeeba Subscription as well.
Refer to Akeeba Subscription documentation,
After you create Subscriber_A in user group(under public), you can create access level called Premium_Content, adds ONLY Subscriber_A group. Then you assign appropriate FC fields to Premium_Content access level. I haven't tried but I guess this should work.

Brandon

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

More
12 years 6 months ago #33474 by ggppdk
-- Assign to user group ? You do not need to

you see each access level is assigned to 1 or more User Groups, so

1. Create an access level "DownloadAccess",
2. assign it to the desired user group(s) e.g "FileSubscribers"
3. Create a FLEXIcontent file field and assign it to the desired FLEXIcontent Item Type(s)
4. For every file that you add to an item, set the access level to be "DownloadAccess"

In older versions you needed to visit file manager to change access level of file, in newer you can change access level while uploading file, (i don't remember if this is available in r1601, but anyway next version is close)

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
12 years 6 months ago #33492 by kath
great, thank you!

in case others need this: here is my solution, applied to a FC-category-items-template:

[snip]
Code:
<? /* * @descr * @return bool * @param int joomla_user_group id * @param optional bool check_inherited_group (default=true) */ function user_is_in_group($i_group_id, $b_inherited=true){ $user =& JFactory::getUser(); $user_id = $user->get('id'); if($b_inherited){ //include inherited groups jimport( 'joomla.access.access' ); $a_groups = JAccess::getGroupsByUser($user_id); }else{ //exclude inherited groups $a_groups = isset($user->groups) ? $user->groups : array(); } return in_array($i_group_id, $a_groups); } ?> <ul> <? $user_is_subscriber = user_is_in_group(7); // lets say my subscripbers' group id is 7 foreach($this->items as $item): $title = "<div>{$item->title}</div>"; $pdf = $user_is_subscriber ? "<div>".FlexicontentFields::getFieldDisplay($item, 'pdf')."</div>" : '<div>'.JText::_("BA_ATTACHMENT_VISIBLE_FOR_SUBSCRIBERS").'</div>'; ?> <li> <?=$title?> <?=$pdf?> </li> <? endforeach; ?> </ul>
[/snip]

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

More
12 years 6 months ago #33495 by ggppdk
Your solution is doing it "manually",

if you decide to use the file field as describe above, then the newly updated file field has various new options for non-authorized users:

-- display filename but no-download link
-- also show a message to non-authorized users
-- link to a URL (e.g. to buy a subscription)

NOTE about subscription stuff, your subscription component should add the users to the appropriate Joomla user Group, this applies for your "manual" solution or for the solution suggested above too (but you already know this)

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.349 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save