Skip to main content

Posts

How to create user and send mail by custom code drupal 7

$mail = 'dharmendrait08@gmail.com'; $phone = '8568077276'; $name = 'teste_user';   //set up the user fields   $fields = array(     'name' => $name,     'mail' => $mail,     'pass' => $phone,     'status' => 1,     'init' => $mail,     'roles' => array(       DRUPAL_AUTHENTICATED_RID => 'artist',     ),   );   $account = user_save('', $fields);   $account = user_load($account->uid);   $account->password = $fields['pass'];   $account->field_phone['und'][0]['value'] = $phone;   $account->field_name['und'][0]['value'] = $name;   $account->field_user_type['und'][0]['value'] = 'Artist';       $op = 'register_no_approval_required';   $data = _user_mail_notify($op, $account);

Dynamic query in drupal 7

Today i am demonstrating how to write dynamic query in drupal 7, $query  =  db_select('node','n')                  ->fields('n',array('title','nid'))                  ->condition('n.status',1)                  ->execute(); It simply returns the object of the current query, foreach($query as $result){     echo $result->title; } How To Use database function in dynamic query  $tbl = 'secc_rural';  $house_hold_id = '09280030005';   $query = db_select($tbl.".individual_21", "n");   $query->fields('n',array('name','ahl_tin','ahl_tin','fathername','name_sl','mothername','occupation','yob','hof','genderid','relation','house_hold_id'));   //$query->addExpression('substr(house_hold_id,1,11)',$house_hold_id);   $query->where('substr(house_hold_id,1,11) = :h...

How to integrate apache solar search integration..

http://www.slideshare.net/reallyordinary/intro-to-apache-solr-for-drupal-8157887?related=1 I am setting the solr with lando dev tool: 1 - setup the sole server & other settings in lando.yml file like this, services:   phpma:     type: phpmyadmin   search:     type: solr:8     core: drupal8     portforward: 8983     config:       dir: config/solr-conf/8.x proxy:   phpma:     - phpma.panth-rare.lndo.site   solr:     - solr.panth-rare.lando.site:8983 After it, run lando rebuild & lando start Now your solr server is ready, enable the search_api_solr module, and add the solr server, Full Documentation how to install & configure the solr on drupal 8 with Lando https://opensenselabs.com/blog/tech/use-apache-solr-drupal-8 After a successful server setup, download the config.zip file & put it config/solr-conf/8.x,   where config is the ...

How to user Despite vs In spite of

by the way both of them , in spite of and despite are synonyms Hindi meanig is " के बावजूद " Despite means "even though,"  => भले ही "notwithstanding," => होते हुए भी, हालांकि or "regardless of." It’s the opposite of "because of/due to," and can be used with a noun or gerund.

What is github and how to use it

Github is a plateform to share code with friends, colleagues or any unknows persons. it's also used to keep backup of our code. github is actually two types free and paid, if you want to keep our code privately then you need to pay , for free account the code will be public anyone can see it and can download the code. How to start using GitHub for Linux   First thing first, you need to have the GitHub account if not then register yourself on Github ( https://github.com/ ). commands for GitHub to create, update and download the repository 1- first install git on our Linux system if you don't have. sudo apt-get install git Configure git directory and pull the code from Github  navigate to the working directory like cd /var/www/html/drupal-8 Run these below commands to initialize the git & configure it. git init git config --global user.name "raj" (here raj is my username) git config --global user.email "dharmendrait08@gmai...