Setting Default State and Access Levels of Submissions

Posted by Aaron Precious on Tuesday, 30 July 2013
Tags - Joomla! | submissions | Zoo

We were creating a feature for a client’s website where registered users could upload (via zoo submissions) their own content. This feature was a private feature and only meant for the eyes of the registered users. So our first issue was that even though the menu items to view the page displaying the content was set to access level registered, if someone searched the site (using the search box) the items would still be displayed since their access levels were set to public by default.

There are a total of 3 options to solve this dilemma depending on your situation.

  1. If ALL content on the site is for registered users only you can set the default access level to registered in the Site->Global Configuration->Default Access Level
    • Note: all content you create via the backend will also have the access level set to the default access level you applied above
  2. Place the access element into your submission layout and leave it up to the users to always change the value
  3. Change the default value of the access level for ALL submissions by editing 1 line of code
    • Line 525 (at least for my file) of the following file
      • /public_html/components/com_zoo/controllers/submission.php
    • Change this line...
      • $this->item->access = $this->app->joomla->getDefaultAccess();
    • To the following (to set the access level to registered)...
      • $this->item->access = $this->app->joomla->2;

We also wanted the submissions to be published by default, since we did not want to add the state element to our submission layout and leave it up to the user to always change the state from unpublished to published. To resolve this we did something very similar to step 3 of the above problem.

  1. Change the default state for ALL submissions by editing 1 line of code
    • Line 529(at least for my file) of the following file
      • /public_html/components/com_zoo/controllers/submission.php
    • Change this line...
      • $this->item->state = 0;
    • To the following...
      • $this->item->state = 1;

Please note that the solutions we came up with and decided to use affects ALL zoo submissions.

0.0/5 rating (0 votes)

Comments (0)

Leave a comment

You are commenting as guest. Optional login below.