Elxis CMS Forum
Extensions => Components => Topic started by: CREATIVE Options on June 15, 2011, 14:49:02
-
I have start a modification on IOS Downloads so a listing can be accessed from 2 user groups.
Steps:
1. Add a custom field in DB "access2" in ***_downloads_files
DELETED OLD CODE FROM CREATIVE OPTIONS
-
You confused the download access with the add new listing access. You only need to add a second download access.
downloads.class.php
Line 400: public $access = '29'; //download access
Add bellow:
public $access2 = '29'; //download access
admin.downloads.php
line 671: $lists['access'] = mosAdminMenus::Access($row);
Add bellow:
$ac = $row->access;
$row->access = $row->access2;
$lists['access2'] = mosAdminMenus::Access($row);
$row->access = $ac;
unset($ac);
line 937: $row->access = ''.intval($row->access).'';
Add bellow:
$row->access2 = ''.intval($row->access2).'';
admin.downloads.html.php
line 965:
<tr>
<td valign="top"><?php echo $adminLanguage->A_ACCESS; ?></td>
<td><?php echo $lists['access']; ?></td>
</tr>
Add bellow:
<tr>
<td valign="top"><?php echo $adminLanguage->A_ACCESS; ?></td>
<td><?php echo $lists['access2']; ?></td>
</tr>
downloads.php
line 747, add access2:
$database->setQuery("SELECT id, file, downloads, access, access2 FROM....
line 755:
if (!in_array($row->access, explode(',',$my->allowed))) {
Convert it to:
if (!in_array($row->access, explode(',',$my->allowed)) && !in_array($row->access2, explode(',',$my->allowed))) {
If you want to also edit listings from frontend you have also to make similar changes as for the admin area.
downloads.html.php
line 459:
."\n AND access IN (".$my->allowed.")";
convert it to:
."\n AND ((access IN (".$my->allowed.")) OR (access2 IN (".$my->allowed.")))";
line 547:
if (in_array($row->access, explode(',',$my->allowed))) {
convert it to:
if (in_array($row->access, explode(',',$my->allowed)) || in_array($row->access2, explode(',',$my->allowed))) {
line 616:
."\n AND access IN (".$my->allowed.")";
convert it to:
."\n AND ((access IN (".$my->allowed.")) OR (access2 IN (".$my->allowed.")))";
line 825:
if (!in_array($row->access, explode(',',$my->allowed))) {
convert it to:
if (!in_array($row->access, explode(',',$my->allowed)) && !in_array($row->access2, explode(',',$my->allowed))) {
line 839:
if (in_array($row->access, explode(',',$my->allowed))) {
convert it to:
if (in_array($row->access, explode(',',$my->allowed)) || in_array($row->access2, explode(',',$my->allowed))) {
If you want to also edit listings from frontend you have also to make similar changes as for the admin area.
WARNING: access and access2 should at least of the same level. If for example you provide access = 18 (registered) and access2 = 29 (public frontend) guests will be able to download the file (because of the OR operator used to check access)! So you must set both access elements to at least user group 18 (registered) if you want to restrict access only to registered users and above.
-
Thank you Datahell,
I will apply them ASAP, and I will get back.
-
Hmm...
doesn't work.
Setting 1st group "Professionals"
Setting 2nd group "Students"
And return:
Access 1= "Students"
&
Access 2 = "Public Front end"
Any idea ?
[attachment deleted by admin]
-
This is an exercise for you: find the problem by your self! ;D
-
LOL
-
datahell ;D
can approach the issue is from the other side
make two listings with its own settings as a category on the forum
-
No because, It's customer's website who upload every month ~10 - 15 files for different access level.
-
Done!
-
This is an exercise for you: find the problem by your self! ;D
Done!
just perfect
came as something past and found the answer under your nose, ;D?