Elxis CMS Forum

Support => Security => Topic started by: Bezman on November 07, 2015, 14:41:52

Title: IOS Slider only shows Guest level content
Post by: Bezman on November 07, 2015, 14:41:52
Hi,

This is probably just me being stupid, as usual.
I am unable to get any slider to show news articles with an Access level higher than "Guest".
For example, if I use the IOS slider module, on the tab Parameters I select "Category" and then "News".
News is a category only available to logged in users, so all those articles have the access level set to "User" (aka minimum "2").

Now, even if I am logged in, as a user or as an administrator, the IOS slider refuses to show anything.
If I change the access level for any of the articles in the selected category from "User" down to "Guest", then IOS slider starts showing them.
What am I doing wrong?

(If I select another news category which only contains "public articles", then it works fine. And if I choose "Multiple categories", only "Guest" level articles are shown. I have the same problem with other news sliders, like iView... so I haven't bothered to test any other sliders, since the problem appears to be elsewhere.)
Title: Re: IOS Slider only shows Guest level content
Post by: datahell on November 08, 2015, 12:31:00
I will chevk later and answer you agsin. Till then do this: Make sure caching is disabled in module and tell me if this solved the problem.
Title: Re: IOS Slider only shows Guest level content
Post by: Bezman on November 08, 2015, 14:14:39
OK. Changed the cache settings from Yes to No, emptied the cache, logged out, logged in as another user - same result though.
Logged out and logged in as admin again - still the same.
Problem remains.
If you want the site's address, I can PM it to you.
Title: Re: IOS Slider only shows Guest level content
Post by: datahell on November 08, 2015, 19:24:45
I checked the module. IOS Slider only displays articles available to guests. If an article/category is for registered users it will not display them regardless if you login or not. So, it works fine for the purpose it designed for (a frontend slider visible to site public visitors), although I understand it doesn't work as you want. I write you below a modification of the module that will make it work as you want but please read the notices at the end.

Open this file with a text editor: modules/mod_iosslider/mod_iosslider.php
Go to line 278 and change this:
$lowlev = 0;
to this:
$lowlev = $elxis->acl()->getLowLevel(); $exactlev = $elxis->acl()->getExactLevel();

Go to line 302 and change this:
$sql .= "\n AND a.alevel = :lowlevel ORDER BY a.created DESC";
to this:
$sql .= "\n  AND ((a.alevel <= :lowlevel) OR (a.alevel = :exactlevel)) ORDER BY a.created DESC";

Go to line 303:
$binds[] = array(':lowlevel', $lowlev, PDO::PARAM_INT);
Add below:
$binds[] = array(':exactlevel', $exactlev, PDO::PARAM_INT);

Save the file and you are ready.

Be careful: The access check is applied on articles access level, not in category. Although Elxis might have fixed automatically the articles access level if you have made the category available to registered users, make sure the articles inside the category have the proper access level.
Title: Re: IOS Slider only shows Guest level content
Post by: Bezman on November 25, 2015, 16:43:00
Thanks for the excellent code clip - I am not that good yet at php.

I have implemented and tested the change, and it appears to work fine - thank you!