Locator shows unpublished first page as "Home"

A place to report and discuss bugs - please mention CMSimple-version, server, platform and browser version
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Locator shows unpublished first page as "Home"

Post by cmb » Mon Jan 12, 2015 1:01 am

Hello Community,

Ludwig pointed out an issue: the "Home" link of the locator (requires $cf['locator']['show_homepage'] == 'true', what's the default) points to the first page, even if it is unpublished. I would say that's a bug. If the first page is hidden, it is also shown as "Home", but this might be regarded as a feature -- what do you think?

I have investigated a bit: this part of the locator() function hard-codes the page index as zero, what stems directly from the classic CMSimple where this was okay, because unpublished pages were removed from the page arrays ($c, $h, $u etc.) As this is not the case for CMSimple_XH, the zero has to be replaced by the page index of the first published page[1]. I tried to use $_XH_firstPublishedPage (which has been introduced with XH 1.6.3), but the variable doesn't recognize the page_params settings (to avoid the core depending on a particular plugin).

I'm not sure how to solve this issue. I see the following options:
  1. make $_XH_firstPublishedPage aware of the respective page_params setting, and use it in locator()
  2. leave $_XH_firstPublishedPage alone, but check for the respective page_params setting in locator()
  3. declare it as WONTFIX, or, more appealingly, a feature ;) (at least for XH 1.6.x)
I tend to (1), if we integrate this functionality in the core with XH 1.7. Otherwise I would prefer (3).

[1] Interestingly, there had been versions (e.g. r32) which didn't use a hard-coded zero. Not sure why.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Locator shows unpublished first page as "Home"

Post by svasti » Fri Jan 16, 2015 12:01 am

Seems to me it should be –> (1)

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Locator shows unpublished first page as "Home"

Post by cmb » Sun Jan 18, 2015 11:28 pm

cmb wrote:I tried to use $_XH_firstPublishedPage (which has been introduced with XH 1.6.3), but the variable doesn't recognize the page_params settings (to avoid the core depending on a particular plugin).
Nonsense. $_XH_firstPublishedPage had been supposed to be correctly updated by page_params, but I've screwed up the implementation. Hopefully fixed with r1461.
svasti wrote:Seems to me it should be –> (1)
I have replaced all hard coded zeros with $_XH_firstPublishedPage in locator() (r1464).
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply