Hello,

I enabled the module with inline submodule.

Only on login does the selector show.

How could I show it on the user/register page as well?

Comments

andriy_gerasika’s picture

why? if you do not have an account and are logging in via OpenID it will create Drupal account automatically

giorgio79’s picture

Yes, but users who do not have an account will first go to User Register :)

And there is no OpenID Selector.

So they will register there...

andriy_gerasika’s picture

if you have both Login and Register links present in top block, you can redo that as simple Login link to /user -- this form will show both login, register and forgot my password

giorgio79’s picture

For me on the /user page I only have login block, plus OpenID Selector.

How can I put the register block on there as well and redirect /user/register to /user?

By default, Drupal has

/user for login block
and
/user/register
for register block.

Not sure how I can merge them.

andriy_gerasika’s picture

can you send me URL of the website?

giorgio79’s picture

Sure, here is login
http://www.reviewcritical.com/user

and here is register
http://www.reviewcritical.com/user/register

These urls for login and register are the default for a Drupal installation.

andriy_gerasika’s picture

http://www.reviewcritical.com/user contains links to register and password subforms.

on your front page, in the bottom-right corner you have 3 links -- register, login, account. make just one link to /user -- if user is not logged in, link title should be "login" or "login or register", if user is logged in, link title becomes "account". but link is always the same -- /user

giorgio79’s picture

Ok thanks.

How about showing Openid Selector on Register page as well? Could we do that also?

andriy_gerasika’s picture

it is complex, OpenID Selector replaces core OpenID form.
Since Drupal does not put core OpenID form on user register page, there is nothing for OpenID Selector to replace.

First step would be to make core OpenID form appear on on user register page.

giorgio79’s picture

Tried copy and pasting the OpenID form alter for register block to this module, but not quite there yet...


function openid_selector_form_alter(&$form, $form_state, $form_id) {
  $forms = array(
    'user_login_block' => 'user-login-form',
    'user_login' => 'user-login',
    'openid_user_add' => 'openid-user-add',
	'user_register' => 'user_register',
  );
  if (array_key_exists($form_id, $forms)) {
    $library_path = libraries_get_path('openid-selector');
    $module_path = drupal_get_path('module', 'openid_selector');
    $style = variable_get('openid_selector_style', '');
    if ($style != '' && file_exists($library_path . '/css/openid-' . $style . '.css')) {
      $style = '-' . $style;
    }
    drupal_add_css($library_path . '/css/openid' . $style . '.css', 'module');
    drupal_add_css($module_path . '/openid_selector.css', 'module');
    drupal_add_js($library_path . '/js/openid-jquery.js');
    $lang = 'en'; // default language
    global $language;
    if (file_exists($library_path . '/js/openid-jquery-' . $language->language . '.js')) {
        $lang = $language->language;
    }
    drupal_add_js($library_path . '/js/openid-jquery-' . $lang . '.js');
    drupal_add_js($module_path . '/openid_selector.js');
    $settings = array(
      'img_path' => $library_path . '/images/',
      'form_id' => $forms[$form_id],
    );
    drupal_add_js(array('openid_selector' => $settings), "setting");
  }

  if ($form_id == 'user_register') {
    drupal_add_css(drupal_get_path('module', 'openid') .'/openid.css', 'module');
    drupal_add_js(drupal_get_path('module', 'openid') .'/openid.js');
    if (!empty($form_state['post']['openid_identifier'])) {
      $form['name']['#required'] = FALSE;
      $form['pass']['#required'] = FALSE;
      unset($form['#submit']);
      $form['#validate'] = array('openid_login_validate');
    }

    $items = array();
    $items[] = array(
      'data' => l(t('Log in using OpenID'), '#'),
      'class' => 'openid-link',
    );
    $items[] = array(
      'data' => l(t('Cancel OpenID login'), '#'),
      'class' => 'user-link',
    );

    $form['openid_links'] = array(
      '#value' => theme('item_list', $items),
      '#weight' => 1,
    );

    $form['links']['#weight'] = 2;

    $form['openid_identifier'] = array(
      '#type' => 'textfield',
      '#title' => t('Log in using OpenID'),
      '#size' => ($form_id == 'user_login') ? 58 : 13,
      '#maxlength' => 255,
      '#weight' => -1,
      '#description' => l(t('What is OpenID?'), 'http://openid.net/', array('external' => TRUE)),
    );
    $form['openid.return_to'] = array('#type' => 'hidden', '#value' => url('openid/authenticate', array('absolute' => TRUE, 'query' => user_login_destination())));
  }
}

andriy_gerasika’s picture

Status: Active » Postponed
andriy_gerasika’s picture

Status: Postponed » Closed (works as designed)