Drupal

Drupal 7 Exposed filter empty results display fix

Setting Exposed filters to not show default values and not sow empty results behavior:

in theme put :


function bartik_preprocess_views_view(&$vars) {
//name = Views machine_name
  if ($vars['view']->name == 'find_friend') {
    if (empty($vars['view']->exposed_input)) {
      $vars['rows'] = array();
      $vars['empty'] = '';
    }
  }
}

Drupal 7 user-profile.tpl

Accessing hidden vars in some d7 themes :
to do do this

<?php
// get menu item 
$account = menu_get_object('user');
$mail = $account->mail;
$name = $account->name;
// field_first_name set to hidden
$fname = $account->field_first_name['und'][0]['value']; 

$lname = $account->field_last_name['und'][0]['value'];

echo "<h2>".$fname.' '.$lname."</h2>";

?>

Drupal 7 Page title override

// template.php your theam name 
function bartik_preprocess_page(&$vars) {
	 global $user; 
	 $uid = $user->uid; 
  $path = drupal_get_path_alias();
 // dsm($path); 
 if($path =='user/'.$uid.'/registrations'){
	 drupal_set_title("Purchased Registrations");
 }

}

drupal 7 overriding page title

Add Ubercart Feature Automaticly

I had an issue where we needed to have add ubercart feature on every product - and did not want to make my client add the new feature every time as would take too much time
as there is now way to set default features  in this case I needed to add Price Quotes   as this project was using ubercart as a quote system , so what was a person to do ?
the anwser is the rules module !

Create a new rule run when content is created and type is "product"... Exacute custom php ...