Skip to main content

Posts

Showing posts from September, 2015

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 ...