When not logged in, with a login block on the front page I am getting the error:

Notice: Undefined variable: login_div in include() (line 18 of /home/elijah/websites/loc.example.com/docroot/profiles/all/modules/contrib/gigya/theme/gigya-login-block.tpl.php).

I searched the code base and it does appear that /gigya-login-block.tpl.php is calling for a variable that never gets defined. Is it just not definied or is it calling the wrong variable?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Elijah Lynn’s picture

Title: Undefined variable: login_divin include() (line 18 of ../gigya-login-block.tpl.php) » Undefined variable: login_div in include() (line 18 of ../gigya-login-block.tpl.php)
richburke’s picture

Below please find a patch that addresses this issue.

The issue, by the way, is caused by the fact that "login_div" is initialized only conditionally, but it's used even when the Gigya component isn't enabled.

richburke’s picture

Elijah Lynn’s picture

Status: Active » Needs review
Elijah Lynn’s picture

--- a/docroot/profiles/all/modules/contrib/gigya/gigya.module
+++ b/docroot/profiles/all/modules/contrib/gigya/gigya.module

This patch won't apply because it isn't relative to the module directory. Make the patch again within the Gigya module directory and use the --relative option, e.g. git diff --relative

Elijah Lynn’s picture

Status: Needs review » Needs work
richburke’s picture

Oopsie. Thanks for pointing that out Elijah. A new patch is attached.

Elijah Lynn’s picture

Status: Needs work » Reviewed & tested by the community

Works!

Thanks Rich

Elijah Lynn’s picture

Status: Reviewed & tested by the community » Needs work

I revisited this patch as part of an upgrade we are doing from 7.x-4.4 to 4.6 and it isn't throwing the error anymore without the patch applied.

It appears that _gigya_is_component_enabled('login') returns TRUE because the variable gigya_login_enabled is not actually set anywhere but we had it set to 0 in a Feature.

function template_preprocess_gigya_login_block(&$variables) {
  if (_gigya_is_component_enabled('login')) {
    $variables['login_div'] = gigya_loginui_js();
    if (!$variables['suppress_title']) {
      $variables['title'] = t('Login using social networks');
    }
  }
}
function _gigya_is_component_enabled($component) {
  return (bool) variable_get('gigya_' . $component . '_enabled', TRUE);
}

Did this variable gigya_login_enabled ever exist and was removed?

Elijah Lynn’s picture

Status: Needs work » Closed (works as designed)

On further thought, let's mark this as Works as designed. Nobody else commented on this in over a year and that means it is unlikely anyone has had this issue.