I get always overriden captha in features, even if it's not.

Hook hook_captcha_default_points_alter conflicts with features default alter hook for captcha, which was added in https://www.drupal.org/node/825088. I didn't understand it comletelly, so maybe it's features bug. But I think different functionality hooks mathed with each other by names unintentionally in captcha module.

I made some fix with removing this hook. This hook adds default forms for admin captcha UI, so the form will lose default values, but its can be added by manual input. So it's not critical, but it's not correct, I think. My fix will be attached in comments.

Can you check it and find correct fix?

Comments

kalistos created an issue. See original summary.

kalistos’s picture

Title: Feature is overridden always. » Feature is overridden always
Status: Active » Needs review
StatusFileSize
new1.63 KB

I wish module developer to check my patch and find for correct fixing my problem.
My patch is incorrect maybe!

rjacobs’s picture

It looks like this was discussed when exportables support was added: #825088-51: Exportables support for CAPTCHA points, though it seems like it was not dealt with there.

I think that removing hook_captcha_default_points_alter() would prevent several defaults from getting set, so I'm not sure if that alone would be an acceptable fix to the issue.

nedjo’s picture

The code removed in this patch is basically providing some default captchas. That makes sense now that captcha data are exportable. The problem seems to be that, in introducing a new form of providing default captchas, we didn't remove the old one.

Should we at the same time replace these defaults? If so, there would be two options:

  • Replace them with default captchas.
  • Replace them by creating them through a hook_install() implementation.

Of the two, I'd say the second is probably cleaner. It initializes the captchas, but doesn't interfere if for example another module wants to provide exported versions of the same captchas.

rjacobs’s picture

The problem seems to be that, in introducing a new form of providing default captchas, we didn't remove the old one.

Hummm, I'm probably missing something about the history of the exportables feature addition. What is the "old" way that was not removed?

Replace [defaults] by creating them through a hook_install() implementation.

You noted that this was probably the preferred way to go. That makes sense as it's much cleaner, but I think it would also remove the ability for the module to easily add defaults for new forms that are added after module installation (e.g., a new content type is added). By using hook_captcha_default_points_alter() it seems like the defaults are always re-evaluated, and missing forms not already captured in config are detected, whenever ctools_export_load_object() is called. This is of course very handy when the admin form is loaded (new defaults can sanely be suggested real-time) but it's not so great for features integration.

I personally don't have a lot of programmatic experience with ctools exportables, so I'm not sure if I know what the best practice would be for these cases... additional default detection logic in captcha_admin_settings()?

mengi’s picture

I am getting the same issue; features that have Captcha points are showing as overridden. When I attempt to recreate the feature, the Captcha configuration/point isn't shown in the Components section. I am unable to remove the Captcha point from the feature in the UI, so it permanently shows overridden.

Revert or recreation does not solve the problem.

renrhaf’s picture

Same here

michelle’s picture

Having this same issue and the patch doesn't help.

siavash’s picture

This patch seems to have fixed the issue for me.

webdrips’s picture

The patch worked for me thanks.

dmsmidt’s picture

Status: Needs review » Needs work

As per #5 there should be defaults for new forms.
A way has to be found to to work together with features.

japerry’s picture

Status: Needs work » Closed (outdated)

Drupal 7 is no longer supported, closing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.