Views fields relacionados con los usuarios, autores..

// En el template.php
 
// Para el campo, Nodo: nombre de autor
 
function phptemplate_username($object) {
 
  if ($object->uid && $object->name) {
    // Shorten the name when it is too long or it will break many tables.
    if (drupal_strlen($object->name) > 20) {
      $name = drupal_substr($object->name, 0, 15) .'...';
    }
    else {
      $name = $object->name;
    }
 
    if (user_access('access user profiles')) {
       // la línea de 

Módulo OG: error en el argumento de las vistas => OG: Group nid(s)

//Fichero og_views.inc
 
// Línea 349, realizar siguiente cambio:
- return l($name, "node/". intval($query->group_nid));   // quitar esta linea
+ return l($name, $arg."/". intval($query->group_nid));  // añadir
 
 
// Línea 378, el siguiente:
- return l($name, "node/$query->group_nid");   //quitar
+ return l($name, "$arg/$query->group_nid");   //añadir

Accesibilidad bloque de suscripción de SIMPLENEWS

 // En el phptemplate
 
 function phptemplate_radio($element) {
 
  // Create a random number to append to the ID
  //This is required as with e.g. poll mudule, the poll
  // node appears twice resulting in duplicate IDs
 
  $new_rand_no = (mt_rand(10,1000000));
 
  _form_set_class($element, array('form-radio'));
  $output = '<input type="radio" ';
  $output .= 'name="' . $element['#name'] .'" ';
  $output .= 'value="'. $element['#return_value'] .'" ';
  $output .= 'id="'. $element['#id'] . '_' . $element['#return_value'] . $new_rand_no .'" ';
  $output 

Accesibilidad formulario de CONTACTO

// En un módulo, dentro de una función form_alter
 
  if ($form_id == 'contact_mail_page') {
    $form['mail']['#id'] = 'edit-mail-comment';
    $form['submit']['#id'] = 'edit-submit-comment';
 
    $form['name']['#default_value'] = 'Nombre';
    $form['subject']['#default_value'] = 'Asunto';
    $form['message']['#default_value'] = 'Mensaje';
    $form['mail']['#default_value'] = 'E-mail';
    $form['cid']['#default_value'] = 0;
}

Accesibilidad tablas de los filtros del módulo VIEWS

//En el template.php
 
function phptemplate_views_filters($form) {
  $view = $form['view']['#value'];
 
  foreach ($view->exposed_filter as $count => $expose) {
    $row[] = drupal_render($form["op$count"]) . drupal_render($form["filter$count"]);
    $label[] = $expose['label'];
  }
  $row[] = drupal_render($form['submit']);
  $label... Leer mas

Accesibilidad tablas del módulo EVENT

// en el template.php
 
function phptemplate_event_calendar_month($op, $header, $rows, $attributes = array(), $caption = NULL) {
  $attributes['summary'] = 'Calendar';  
  $output = theme("table", $header, $rows, $attributes, $caption);
  return '<div class="event-calendar"><div class="month-view">'. $output ."</div></div>\n";
}

hook_link y su potencia

<?php
/**
 * Implementation of hook_link().
 * 
*/
function movida_link($type, $object, $teaser = FALSE) {
 
  if ($type == 'node') {
    $node_type= variable_get('movida_'. $type, FALSE);
    if ($node_type == '1') {
      $links = array();
      $links['gears_create'] = array(
        'title' => t('Create'),
        'href' => "manifest/node_create",
      );
      $links['movida_delete'] = array(
        'title' => Leer mas

Accesibilidad bloque search

function nombremodulo_form_alter($formid, &$form) {
 if ($formid == 'search_block_form'){
  $form['search_block_form_keys']['#title'] = 'Buscar';
 }
}

Primer elemento de una lista con jquery

 $(function(){
      $('.view-content-avisos li:first').addClass('destacadoss');
  });

Formulario select del nombre de las vistas

 $form['views_existing'] = array(
    '#type' => 'fieldset',
    '#title' => t('Existing views'),
     '#collapsible' => 1,
 );
 
  $result = db_query("SELECT name FROM {view_view} ORDER BY name");
  while ($view = db_fetch_array($result)) {
    $form['views_existing']['views_'.$view['name']] = array(
      '#type' => 'checkbox',
      '#title' => t('@s', array&#

Formulario select de tipos de contenidos, cck

 $form['tipos'] = array(
    '#type' => 'fieldset',
    '#title' => t('Título'),
  );
  $types = node_get_types('names');
 
  foreach ($types as $type => $name) {
    $form['tipos'][$type] = array(
      '#type' => 'checkbox',
      '#title' => t('@s', array('@s' => $name)),
      '#default_value' => variable_get(

Pintar una imagen con imagecache

 <?php print theme('imagecache','preset',$node->field_campo[0]['filepath'])?>

Diseño y desarrollo INVESTIC con DRUPAL