Joomla Asked by AHeavyObject on September 5, 2021
I have in the code I don’t conrol such a line which returns false:
if (!$user->authorise('core.create', 'com_jdownloads.category.'.$option->value)) {
I can run my code before and after this line (via a plugin).
I need to temporary allow user to permit the action currently banned with the code above, and after done, and change permissions back.
Is this possible and how?
=========
Long story upon @Irata request
@Irata I’m a developer of extension, which sends email notifications on Joomla content update – NotificationAry (NA),
https://extensions.joomla.org/extension/notificationary/
Though it mainly works with JDownloads, I meet a problem reported by a user. NA allows users to subscribe per category and in User profile one can check categories to be notified on changes in.
Screenshot:
http://images.my-dev.org/x/2020_07_18_16_32_52_nn.png
This works in backend, but fail at frontend.
http://images.my-dev.org/x/2020_07_18_16_34_51_vq.png
To generate a list of JDownload categories I use your field
/administrator/components/com_jdownloads/models/fields/jdcategoryselect.php
In my code it looks like this:
https://github.com/gruz/GJFields/blob/master/categoryext.php#L196
But at frontend it always returns empty array of options. At least now. It was ok some time ago, but maybe years ago.
I checked JDownloads code and it doesn’t allow registered users to get categories list
administrator/components/com_jdownloads/models/fields/jdcategoryselect.php
Line about 115
if (!$user->authorise('core.create', 'com_jdownloads.category.'.$option->value)) {
So at Frontend a registered user is not able to get the list of categories.
I want to get the list of your categories and to use native JDownloads field for this. I try to avoid copying other extensions code into mine because updates can break things. I had to copy JDownloads code, https://github.com/gruz/GJFields/blob/master/categoryext.php#L199 to make it work dirty
You are overcomplicating things. Creating your own field class is the correct solution and you should remove the use of JFormFieldjdCategorySelect
completely.
Answered by Sharky on September 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP