Skip to main content
close quote
Source Link
hotwebmatter
  • 2.1k
  • 1
  • 14
  • 33

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
      '#markup' => '<p>Some text to inform users of new registration procedures</p>p>',
    ];
  }
}

EDIT: If you have never made a Drupal module before, don't be intimidated! The type of thing you're trying to do can be accomplished with a very small module.

Keep in mind that the Drupal Form API is basically just a bunch of PHP arrays.

To add markup to a form array, use the #markup form element as I've shown im my example above.

To remove an element from a form array, you can unset() that value before the array is rendered. For example:

<?php 
unset($form['buttons']['preview']);
?>

I'm not sure what form elements you'll want to remove, but this technique should help.

This stuff is well documented on Drupal.org and all over this forum.

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
      '#markup' => '<p>Some text to inform users of new registration procedures</p>,
    ];
  }
}

EDIT: If you have never made a Drupal module before, don't be intimidated! The type of thing you're trying to do can be accomplished with a very small module.

Keep in mind that the Drupal Form API is basically just a bunch of PHP arrays.

To add markup to a form array, use the #markup form element as I've shown im my example above.

To remove an element from a form array, you can unset() that value before the array is rendered. For example:

<?php 
unset($form['buttons']['preview']);
?>

I'm not sure what form elements you'll want to remove, but this technique should help.

This stuff is well documented on Drupal.org and all over this forum.

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
      '#markup' => '<p>Some text to inform users of new registration procedures</p>',
    ];
  }
}

EDIT: If you have never made a Drupal module before, don't be intimidated! The type of thing you're trying to do can be accomplished with a very small module.

Keep in mind that the Drupal Form API is basically just a bunch of PHP arrays.

To add markup to a form array, use the #markup form element as I've shown im my example above.

To remove an element from a form array, you can unset() that value before the array is rendered. For example:

<?php 
unset($form['buttons']['preview']);
?>

I'm not sure what form elements you'll want to remove, but this technique should help.

This stuff is well documented on Drupal.org and all over this forum.

code indentation
Source Link
hotwebmatter
  • 2.1k
  • 1
  • 14
  • 33

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
          '#markup' => '<p>Some additional text to inform users of new registration procedures</p>,
      ];
  }
}

EDIT: If you have never made a Drupal module before, don't be intimidated! The type of thing you're trying to do can be accomplished with a very small module.

Keep in mind that the Drupal Form API is basically just a bunch of PHP arrays.

To add markup to a form array, use the #markup form element as I've shown im my example above.

To remove an element from a form array, you can unset() that value before the array is rendered. For example:

<?php 
unset($form['buttons']['preview']);
?>

I'm not sure what form elements you'll want to remove, but this technique should help.

This stuff is well documented on Drupal.org and all over this forum.

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
          '#markup' => '<p>Some additional text to inform users of new registration procedures</p>,
      ];
  }
}

EDIT: If you have never made a Drupal module before, don't be intimidated! The type of thing you're trying to do can be accomplished with a very small module.

Keep in mind that the Drupal Form API is basically just a bunch of PHP arrays.

To add markup to a form array, use the #markup form element as I've shown im my example above.

To remove an element from a form array, you can unset() that value before the array is rendered. For example:

<?php 
unset($form['buttons']['preview']);
?>

I'm not sure what form elements you'll want to remove, but this technique should help.

This stuff is well documented on Drupal.org and all over this forum.

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
      '#markup' => '<p>Some text to inform users of new registration procedures</p>,
    ];
  }
}

EDIT: If you have never made a Drupal module before, don't be intimidated! The type of thing you're trying to do can be accomplished with a very small module.

Keep in mind that the Drupal Form API is basically just a bunch of PHP arrays.

To add markup to a form array, use the #markup form element as I've shown im my example above.

To remove an element from a form array, you can unset() that value before the array is rendered. For example:

<?php 
unset($form['buttons']['preview']);
?>

I'm not sure what form elements you'll want to remove, but this technique should help.

This stuff is well documented on Drupal.org and all over this forum.

added 623 characters in body
Source Link
hotwebmatter
  • 2.1k
  • 1
  • 14
  • 33

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
          '#markup' => '<p>Some additional text to inform users of new registration procedures</p>,
      ];
  }
}

EDIT: If you have never made a Drupal module before, don't be intimidated! The type of thing you're trying to do can be accomplished with a very small module.

Keep in mind that the Drupal Form API is basically just a bunch of PHP arrays.

To add markup to a form array, use the #markup form element as I've shown im my example above.

To remove an element from a form array, you can unset() that value before the array is rendered. For example:

<?php 
unset($form['buttons']['preview']);
?>

I'm not sure what form elements you'll want to remove, but this technique should help.

This stuff is well documented on Drupal.org and all over this forum.

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
          '#markup' => '<p>Some additional text to inform users of new registration procedures</p>,
      ];
  }
}

This is well documented on Drupal.org and all over this forum.

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is already logged in (whether through OAuth or standard login) they will not be prompted to log in again.

If, instead, you want to modify the user login options for all users, this can be accomplshed via hook_form_alter() in a custom module, replacing MODULENAME with the name of your module in the hook implementation:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // Your code to modify the form goes here
    $form['some_text'] = [
          '#markup' => '<p>Some additional text to inform users of new registration procedures</p>,
      ];
  }
}

EDIT: If you have never made a Drupal module before, don't be intimidated! The type of thing you're trying to do can be accomplished with a very small module.

Keep in mind that the Drupal Form API is basically just a bunch of PHP arrays.

To add markup to a form array, use the #markup form element as I've shown im my example above.

To remove an element from a form array, you can unset() that value before the array is rendered. For example:

<?php 
unset($form['buttons']['preview']);
?>

I'm not sure what form elements you'll want to remove, but this technique should help.

This stuff is well documented on Drupal.org and all over this forum.

Source Link
hotwebmatter
  • 2.1k
  • 1
  • 14
  • 33
Loading