Premium option on content type cannot be disabled

Created on 4 April 2025, 14 days ago

Problem/Motivation

For each content type, in "Publishing options", you can configure a default value for "Premium content". When you have that option currently enabled, and you try to disable it, after saving the settings, the option remains renabled.

Steps to reproduce

  1. On a content type, enable the option "Premium content".
  2. Click the "Save" button to save the settings.
  3. On that same content type, now disable the option "Premium content".
  4. Click the "Save" button again to save the settings.

Expected result: the option "Premium content" is disabled.
Actual result: the option "Premium content" is still enabled.

The bug is in nopremium_node_type_edit_form_submit(). In there the following check is done that results into saving or not saving the premium setting:

if (in_array('premium', $values['options'])) {

The result of this check is false when the option "Premium content" is disabled, resulting into never updating the premium setting for content type.

Proposed resolution

Use the following check instead:
if (isset($values['options']['premium'])) {

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇳🇱Netherlands megachriz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024