Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/12/2009, 10:18
Avatar de blogger
blogger
 
Fecha de Ingreso: diciembre-2005
Ubicación: frente al monitor
Mensajes: 398
Antigüedad: 18 años, 5 meses
Puntos: 12
Respuesta: Agregar vista (views) al perfil del usuario

Me respondo a mi mismo, ya que nadie supo como ayudarme o no tuvó la disposición para hacerlo. Para aquellos principiantes que quieran mostrar el contenido que escriba un usuario en su perfil, esto es lo que hay que hacer:

Importa el siguiente código al modulo Views, pero antes de hacerlo edita donde dice "mi contenido" por lo que quieras mostrar (mis articulos, mis poemas, etc.):

Código PHP:
$view = new view;
$view->name 'mi_contenido';
$view->description 'users content';
$view->tag 'Users';
$view->view_php '';
$view->base_table 'node';
$view->is_cacheable FALSE;
$view->api_version 2;
$view->disabled FALSE/* Edita a true para inicialmente deshabilitar la vista por default */
$handler $view->new_display('default''Defaults''default');
$handler->override_option('fields', array(
  
'title' => array(
    
'label' => 'Título',
    
'alter' => array(
      
'alter_text' => 0,
      
'text' => '',
      
'make_link' => 0,
      
'path' => '',
      
'link_class' => '',
      
'alt' => '',
      
'prefix' => '',
      
'suffix' => '',
      
'target' => '',
      
'help' => '',
      
'trim' => 0,
      
'max_length' => '',
      
'word_boundary' => 1,
      
'ellipsis' => 1,
      
'strip_tags' => 0,
      
'html' => 0,
    ),
    
'empty' => '',
    
'hide_empty' => 0,
    
'empty_zero' => 0,
    
'link_to_node' => 1,
    
'exclude' => 0,
    
'id' => 'title',
    
'table' => 'node',
    
'field' => 'title',
    
'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  
'uid' => array(
    
'default_action' => 'empty',
    
'style_plugin' => 'default_summary',
    
'style_options' => array(),
    
'wildcard' => 'all',
    
'wildcard_substitution' => 'All',
    
'title' => '',
    
'default_argument_type' => 'fixed',
    
'default_argument' => '',
    
'validate_type' => 'none',
    
'validate_fail' => 'not found',
    
'break_phrase' => 0,
    
'not' => 0,
    
'id' => 'uid',
    
'table' => 'users',
    
'field' => 'uid',
    
'relationship' => 'none',
    
'default_options_div_prefix' => '',
    
'default_argument_fixed' => '',
    
'default_argument_php' => '',
    
'validate_argument_node_type' => array(
      
'blog' => 0,
      
'poll' => 0,
      
'forum' => 0,
      
'panel' => 0,
      
'book' => 0,
      
'ecobytes' => 0,
      
'event' => 0,
      
'faq' => 0,
      
'incentive' => 0,
      
'job_notice' => 0,
      
'office_docs' => 0,
      
'page' => 0,
      
'press_release' => 0,
      
'program' => 0,
      
'resource' => 0,
      
'solutions' => 0,
      
'staff_help' => 0,
      
'story' => 0,
      
'support_request' => 0,
      
'tips' => 0,
    ),
    
'validate_argument_node_access' => 0,
    
'validate_argument_nid_type' => 'nid',
    
'validate_argument_vocabulary' => array(
      
'3' => 0,
      
'1' => 0,
      
'9' => 0,
      
'2' => 0,
      
'5' => 0,
      
'4' => 0,
      
'8' => 0,
      
'7' => 0,
      
'6' => 0,
    ),
    
'validate_argument_type' => 'tid',
    
'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  
'status' => array(
    
'operator' => '=',
    
'value' => '1',
    
'group' => '0',
    
'exposed' => FALSE,
    
'expose' => array(
      
'operator' => FALSE,
      
'label' => '',
    ),
    
'id' => 'status',
    
'table' => 'node',
    
'field' => 'status',
    
'relationship' => 'none',
  ),
  
'type' => array(
    
'operator' => 'in',
    
'value' => array(
      
'story' => 'story',
    ),
    
'group' => '0',
    
'exposed' => FALSE,
    
'expose' => array(
      
'operator' => FALSE,
      
'label' => '',
    ),
    
'id' => 'type',
    
'table' => 'node',
    
'field' => 'type',
    
'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  
'type' => 'none',
));
$handler->override_option('cache', array(
  
'type' => 'none',
));
$handler->override_option('title''Mi Contenido');
$handler->override_option('empty''Oops no hay contenido...');
$handler->override_option('empty_format''2');
$handler->override_option('items_per_page'100);
$handler->override_option('style_plugin''table');
$handler->override_option('style_options', array(
  
'grouping' => '',
  
'override' => 1,
  
'sticky' => 0,
  
'order' => 'asc',
  
'columns' => array(
    
'title' => 'title',
    
'edit_node' => 'edit_node',
  ),
  
'info' => array(
    
'title' => array(
      
'sortable' => 1,
      
'separator' => '',
    ),
    
'edit_node' => array(
      
'separator' => '',
    ),
  ),
  
'default' => '-1',
));
$handler $view->new_display('page''Page''page_1');
$handler->override_option('path''user/%/micontenido');
$handler->override_option('menu', array(
  
'type' => 'tab',
  
'title' => 'Mi Contenido',
  
'description' => '',
  
'weight' => '6',
  
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  
'type' => 'none',
  
'title' => '',
  
'description' => '',
  
'weight' => '0',
)); 
2. Una vez que hayas importado el código, verifica la configuración de la vista en el modulo Views, y edita los parametros y filtros de la consulta para que se ajusten a tus necesidades.

Y listo, con esto aparecera un tab o sección en el perfil del usuario donde se mostrará las cosas que haya subido.
__________________
http://exegesis-biblica.com/

Última edición por blogger; 10/12/2009 a las 10:23