Skip to content

Instantly share code, notes, and snippets.

<?php
$node = node_load(102570);
$node_view = node_view($node, 'teaser');
$node_rendered = drupal_render($node_view);
smtp_sender_dependent_authentication = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noplaintext noanonymous
smtp_connection_cache_on_demand = no
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_dependent
sender_canonical_maps = hash:/etc/postfix/sender_canonical
/**
* Implements hook_views_query_alter().
*/
function mh_search_wish_views_query_alter(&$view, &$query) {
if ($view->name == 'matching_search_clients') {
$join = new views_join();
$join->table = 'search_wish_hit_status';
$join->field = 'profile_nid';
$join->left_table = 'node';
$join->left_field = 'nid';
$city = 'Rome';
// Get term id of city. taxonomy_get_term_by_name don't work because it
// don't works with multilingual values.
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'taxonomy_term')
->entityCondition('bundle', 'property_country_city')
->fieldCondition('name_field', 'value', $city, '=')
->addTag('term_is_child_of')
->addMetaData('parent_term_id', $country_id)
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'taxonomy_term')
->entityCondition('bundle', 'property_country_city')
->fieldCondition('name_field', 'value', $city, '=')
->range(0, 1)
->addTag('term_is_child_of')
->addMetaData('parent_term_id', $country_id)
->addMetaData('account', user_load(1)); // Run the query as user 1.
$result = $query->execute();
<?php
/**
* @file
* This module controls the access to view profile nodes and its email address
* field.
*/
function mh_profile_access_form_profile_node_form_alter(&$form, &$form_state, $form_id) {
$form['field_profile_e_mail']['und'][0]['email']['#description'] = t('new desc.');
$form['field_profile_e_mail']['und'][0]['email']['#disabled'] = TRUE;
<?php
/**
* @file
* This module controls the access to view profile nodes and its email address
* field.
*/
function mh_profile_access_form_alter(&$form, &$form_state, $form_id) {
if($form['form_id']['#value'] == 'profile_node_form') {
dpm($form);