Welcome, Guest
Username: Password: Remember me

TOPIC: Viewing UnPublished items from the front end?

Viewing UnPublished items from the front end? 05 Nov 2012 20:21 #5017

  • gdpodesta
  • gdpodesta's Avatar
  • Offline
  • Senior Member
  • Posts: 75
  • Thank you received: 8
  • Karma: -42
Following instructions from another post, I'm using the Publish/Unplublished flag to insure that users can only view/edit their own records. However, for visitors to the site, I want ALL records, published or not, to be visible to them.
  1. Where in the generated code can I tell a view to ignore the Published flag?
  2. Is that the same place that I can apply other custom filtering?
Thanks in advance...am loving COOK more and more every day! :cheer:
The administrator has disabled public write access.

Re: Viewing UnPublished items from the front end? 14 Nov 2012 22:01 #5363

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Not 100% sure that this will work but try just removing the published field if it doesn't matter whether it is published or not. Joomla's core publishing system allows items that are published to be viewed by users in groups with view access and therefore, if a published field exits for a record and is set to unpublished, it will not be visible to users with less than publisher access.

In short, it doesn't make sense to have a published field at all if you simply want to bypass it as it undermines the purpose of having it in the first place.

Hope this makes sense! ;)

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Viewing UnPublished items from the front end? 15 Nov 2012 03:00 #5367

  • gdpodesta
  • gdpodesta's Avatar
  • Offline
  • Senior Member
  • Posts: 75
  • Thank you received: 8
  • Karma: -42
Well, I'm not sure what to do now. Another post said that in order to insure that only the author can view and edit their own records, and most importantly, not allow any other users to even know they exist, I needed to use the Publilshed field, and keep it set to 0. In another view, however, using other criteria, I need to perform some operations on them, whether they're published or not. Thus my question about where "the right place" is to do that.
The administrator has disabled public write access.

Re: Viewing UnPublished items from the front end? 15 Nov 2012 06:59 #5368

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
The intention behind the post that you refer to if I remember correctly was slightly different to your requirements - they only wanted the author to view his/her own record until such time that they published the record (or another user - publisher).

Good luck,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Viewing UnPublished items from the front end? 15 Nov 2012 12:52 #5378

  • gdpodesta
  • gdpodesta's Avatar
  • Offline
  • Senior Member
  • Posts: 75
  • Thank you received: 8
  • Karma: -42
And that's the case for me...the records will never be published in the traditional Joomla sense - they'll only ever be maintained by the owner. The data that is provided there is to be used elsewhere in a non-Joomla application. Thus my choice to use that approach, and most importantly, my interest in the "right" place to do my own filtering.

I want to keep using Cook, so want to put that code wherever it might most likely appear a in future release. At the very least, to put it wherever the author(s) of Cook see that it makes the most sense.
The administrator has disabled public write access.

Re: Viewing UnPublished items from the front end? 15 Nov 2012 13:26 #5380

  • BTB300
  • BTB300's Avatar
  • Online
  • Moderator
  • Posts: 414
  • Thank you received: 130
  • Karma: 46
Hi gdpodesta
Perhaps this may be what you need

In populateParams()
params->set('access-view', true); //This is forcing the item to be shown

I had a similar issue where both the buyer and seller needed to see the data item regardless of who the author was or its published state (the item was unpublished to public views after being sold) and admin kindly offered this solution.

a little further expansion by admin here...
www.j-cook.pro/forum/32-trouble-shooting...fails-build-sql#3736

Hope it helps
Last Edit: 15 Nov 2012 13:41 by BTB300.
The administrator has disabled public write access.
The following user(s) said Thank You: gdpodesta, JoomGuy

Re: Viewing UnPublished items from the front end? 15 Nov 2012 15:40 #5383

  • gdpodesta
  • gdpodesta's Avatar
  • Offline
  • Senior Member
  • Posts: 75
  • Thank you received: 8
  • Karma: -42
VERY helpful....it's not like the "good ole days", where you just located the SQL statement, lol. I often feel like I'm on a treasure hunt trying to find where to specify a WHERE clause, lol.
The administrator has disabled public write access.

Re: Viewing UnPublished items from the front end? 21 Nov 2012 08:52 #5542

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Yes but not only.
All the filter applied are in prepareQuery(). Must find it out.
About the tip of BTB, it is something else.

'access-view' is when you allow for exemple to show the title of it (and some infos of the row), but you do not want any link possibility or else, so you set up a flag that means the item is loaded, but not available.

If you want to really play in strict SQL : prepareQuery()

'access-view' is very important by the way...
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.146 seconds

Get Started