Keyword

Limit access-view by extra field

  • manusa
  • manusa's Avatar Topic Author
  • Offline
  • New Member
More
7 years 2 months ago #162651 by manusa
Limit access-view by extra field was created by manusa
Hello.

I want to limit the view and access of items from the module K2 by one extra field, for example, i create an extra field called "Visibility", and take two possible values: "Yes" and "No".
If the value of "Visibility" is "No" i wont show these items in any list or search result or list of items from its category... If the value is empty (not set), by default, for now i want show those items, and if the value is "Yes" them again, i will show the items.

Is possible to do that with any plugin or its necessary do it programatically?

Thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 months ago #162653 by Krikor Boghossian
Replied by Krikor Boghossian on topic Limit access-view by extra field
It is possible, but you will need a custom plugin.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • manusa
  • manusa's Avatar Topic Author
  • Offline
  • New Member
More
7 years 2 months ago - 7 years 2 months ago #162657 by manusa
Replied by manusa on topic Limit access-view by extra field
Thank you for the reply Krikor.

So its possible but i need to design a custom plugin, its good to know that, because i thinking in modidfy some files and place it in my template/html, but maybe its more interesting make one plugin for this.
Can you give any clue about how to archive that?
I have worked with Wordpress, and i know that there are some "hooks", you can controll some events with they.

Thanks.
Last edit: 7 years 2 months ago by manusa.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 months ago #162659 by Krikor Boghossian
Replied by Krikor Boghossian on topic Limit access-view by extra field
You will still need a system plugin to disallow the ?template querystring.
If you allow that querystring, any user can see the entire item by using a different template.

Admin Tools Pro does this if you are already using it.

As for the extrafield, if you do this in your template you won't need a plugin event (hook). An if/ else cause can do the trick.

Keep in mind that you can manually render an extrafield's value in order to check it.

github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L168-L173

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum