Skip to content

Overruling is_private not possible anymore #2858

@JensSpanier

Description

@JensSpanier
  • I've read the Troubleshooting First Steps
  • This request isn't a duplicate of an existing issue, opened or closed
  • I've read the docs and followed them (if applicable)
  • This is not a personal support request that should be posted on the YOURLS Discourse community

Describe the bug
Overruling yourls_is_private() is not possible anymore

To Reproduce
Steps to reproduce the behavior:

  1. Set define( 'YOURLS_PRIVATE', true ) and define( 'YOURLS_PRIVATE_INFOS', false )
  2. Open info page of a short url
  3. See that it's still private

Expected behavior
YOURLS_PRIVATE_INFOS and YOURLS_PRIVATE_API should have any effect.

Actual behavior
They don't have any effect.

Versions
1.8

Additional context
The problem is in here:

function yourls_is_private() {
$private = false;
if ( defined( 'YOURLS_PRIVATE' ) && YOURLS_PRIVATE ) {
$private = true;
// Allow overruling for particular pages:
// API
if ( yourls_is_API() ) {
if ( !defined( 'YOURLS_PRIVATE_API' ) || YOURLS_PRIVATE_API ) {
$private = true;
}
}
elseif ( yourls_is_infos() ) {
if ( !defined( 'YOURLS_PRIVATE_INFOS' ) || YOURLS_PRIVATE_INFOS ) {
$private = true;
}
// Others
}
}

$private will always be true.

I will provide a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions