News:

Dear forum visitors, if the support forum is not available, please try again a few minutes later. Thanks!

Main Menu
Support-Forum

How to set default Access Level for front end uploads?

Started by carin, 03.08.2014 00:23:42

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arno

QuoteI interpret the above as
if ('access' value selectable in frontend form AND is not "empty") then use value given value
else if ('access' value not selectable in frontend form) then use the new default 'access' value
  else the 'access' from the parent category

Not exactly. The access value has always a value (at minimum 1 for public access level).

See code:

...
         // check the access handling
         if ($user_rules->form_access == 0){
                // the access select field was not viewed so we use the default value for the case that we have not a parent category
                $this->access = (int)$user_rules->uploads_default_access_level;
         }
...
        if ($this->cat_id > 1){
            if ($isNew){
                // set access level value from parent
                $query = "SELECT * FROM #__jdownloads_categories WHERE id = '$this->cat_id'";
                $db->setQuery( $query );
                $parent_cat = $db->loadObject();
                $this->access = $parent_cat->access;
            }
        }
...   
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

tollyorg

I love this forum <3 :D
from tolly
  •  

carin

Quote1. is the 'access' value selectable in frontend form - he is used
2. is the 'access' value not selectable it is use the new default 'access' value
3. has the new download a parent category - the access from the parent category is used

1. if the new default 'access' value is set, the field in the frontend form should hold that value on page load
2. agreed
3. but only if the new default 'access' value is NOT set! this is very important, because my parent categories have a different access level than the download files
Joomla 3.2 | jD 3.2 | PHP 5.3 | Apache 2
  •  

Arno

Quotebecause my parent categories have a different access level than the download files
I have thought about this already.  ;D
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

ColinM

@Arno
The word "empty" was deliberate.  I was seeing this from a user view in that all they see is the option shown initially in the Pull Down list.  Whilst I note what Carin suggests that the special Default, if set, should be shown as the top entry of the pulldown, I am thinking of how to explain things to a user.  Seeing the first option wording as being something like '-Use Parent Access Level-', suitably translated of course, defines the normal way for most people.  From your algorithm the new special default value is only used when the Access field is not shown.  In all other circumstances either the user positively selects an Access level from the pulldown or would leave it as the first entry.  The user does not need to know either the Parent Access level or the Special Default but there is no harm in including it and the special default value at the bottom of the pull down list.

Actually it may be better to refer to the special default value by something like 'user group settings default' as that also indicates where it is set up.

Just some thoughts

Colin
Colin M
  •  

hiro201

I have an issue with this too. Thanks for bringing this up.
  •  

Arno

Hi Guys,
It seems that it is not so easy to implement this new option (which has in the first moment a simple functionality).

Thanks Colin for your thoughts. I agree with you. But we can not create in this moment a new (special) Pull Down list for the access levels with more options (-Use Parent Access Level-).
So it is now only possible to define the new default value directly in the DB. But i want to change it in the next release 3.3.

I have it now in this way implemented:

The new default field value in the DB is now '0' as default (0=not set)

In the form:
the handling is now the same for both scenarios (access select list is viewed or not viewed):
   - if the new default 'access' value is set (>0), the field in the frontend form hold that value on page load
   - if the new default value not set, the access default value is 1 for public access (standard handling in Joomla)
   save process:
   - if the access level now > 1 we store this in the DB, otherwise we use the access level from parent category.
   (Please note that it is not so easy possible to check whether a level from '1' is really selected by the user, or is still the default setting)

My first tests was succesfully. But i think we must test again also the 'normal' Downloads save processes in backend. As we used the same source code also here.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •