You can use the below code remove the password hint details in drupal register page.
/**
* Implements hook_element_info_alter().
*/
function HOOK_element_info_alter(&$types) {
if (isset($types['password_confirm']['#process']) && (($position = array_search('user_form_process_password_confirm', $types['password_confirm']['#process'])) !== FALSE)) {
unset($types['password_confirm']['#process'][$position]);
}
}
Note: Please clear form cache after adding
Web Development Information [PHP, DRUPAL, MYSQL, MAGENTO, JQUERY, JAVASCRIPT, CSS, HTML5]
Tuesday, March 1, 2016
Remove the user tab link in user login page and user register page
We can use the below code to remove the user tab link in user login page and user register page.
/**
* Implementation of hook_menu_alter().
*/
function HOOK_menu_alter(&$items) {
$items['user/login']['type'] = MENU_CALLBACK;
$items['user/register']['type'] = MENU_CALLBACK;
$items['user/password']['type'] = MENU_CALLBACK;
}
Note: Please clear the menu cache after adding this function
/**
* Implementation of hook_menu_alter().
*/
function HOOK_menu_alter(&$items) {
$items['user/login']['type'] = MENU_CALLBACK;
$items['user/register']['type'] = MENU_CALLBACK;
$items['user/password']['type'] = MENU_CALLBACK;
}
Note: Please clear the menu cache after adding this function
Monday, July 6, 2015
Programmatically create view mode for product in Drupal Commerce
1. First create the view mode by using the following hook or Entity View Mode module.
2. Then create the template file commerce-product--product--{view-mode}.tpl.php
3. Inside the template file, you can render what ever you want.
4. Then clear the cache.
2. Then create the template file commerce-product--product--{view-mode}.tpl.php
3. Inside the template file, you can render what ever you want.
4. Then clear the cache.
Monday, June 29, 2015
Generate SSH Key using GIT
Please follow the below steps to create the SSH key in GIT
1) Open Git Bash (type git bash in search bar of windows start)
2) Generate the key using following command
$ ssh-keygen -t rsa -b 4096
This will prompt you to enter file name, just press enter key.
When prompting for passpharse, enter a passpharse. (Note the pharse
which will be used while you clone the repository)
3) Open key file and copy
$ cat /d/Users/<yourloginusername>/.ssh/id_rsa.pub
Friday, June 26, 2015
Drupal commerce programmatically change the quantity of product in a cart by using product id
Programmatically change the quantity of product in a cart by using product id
function product_alter_quanity($product_id, $quantity, $param) {
$line_item_id = product_in_cart($product_id); // product_in_cart() function - http://php-developer-informations.blogspot.co.uk/2015/06/drupal-commerce-add-line-item-delete.html
if ($line_item_id != -1 && $line_item_id != -2) {
if ($param == 'remove') {
$product_quantity_in_cart = commerce_line_items_quantity(array($line_item_id));
if ($quantity >= $product_quantity_in_cart) {
product_delete_cart($product_id);
}
else {
$line_item = commerce_line_item_load($line_item_id);
$line_item->quantity = $line_item->quantity - $quantity;
commerce_line_item_save($line_item);
}
}
elseif ($param == 'add') {
//$line_item_id = product_in_cart($product_id);
$line_item = commerce_line_item_load($line_item_id);
$line_item->quantity = $line_item->quantity + $quantity;
commerce_line_item_save($line_item);
}
}
else {
return -1;
}
}
function product_alter_quanity($product_id, $quantity, $param) {
$line_item_id = product_in_cart($product_id); // product_in_cart() function - http://php-developer-informations.blogspot.co.uk/2015/06/drupal-commerce-add-line-item-delete.html
if ($line_item_id != -1 && $line_item_id != -2) {
if ($param == 'remove') {
$product_quantity_in_cart = commerce_line_items_quantity(array($line_item_id));
if ($quantity >= $product_quantity_in_cart) {
product_delete_cart($product_id);
}
else {
$line_item = commerce_line_item_load($line_item_id);
$line_item->quantity = $line_item->quantity - $quantity;
commerce_line_item_save($line_item);
}
}
elseif ($param == 'add') {
//$line_item_id = product_in_cart($product_id);
$line_item = commerce_line_item_load($line_item_id);
$line_item->quantity = $line_item->quantity + $quantity;
commerce_line_item_save($line_item);
}
}
else {
return -1;
}
}
Subscribe to:
Posts (Atom)