DrupalBin
Submit Code
About
Recent Posts
Code
Fix for Fix for Code
Fix for Code
Code
Node type whitelist
an axe coach accessories
coach purses married
Fix for de las ghd alturas
de las ghd alturas
Code
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
taxonomy
test
theme
views
more tags
Home
Fix for Fix for history data for recently viewed nodes
View
Fix
May 16, 2010 - 7:45pm — Anonymous
<?php
// $Id$
/**
* Implementation of hook_views_handlers().
*/
function
mymodule_history_views_handlers
(
)
{
return
array
(
'info'
=
>
array
(
'path'
=
>
drupal_get_path
(
'module'
,
'mymodule_history'
)
.
'/includes'
,
)
,
'handlers'
=
>
array
(
'views_handler_filter_recently_viewed'
=
>
array
(
'parent'
=
>
'views_handler_filter'
,
)
,
)
,
)
;
}
/**
* Implementation of hook_views_data_alter().
*/
function
mymodule_history_views_data
(
)
{
$data
[
'history'
]
=
array
(
'table'
=
>
array
(
'group'
=
>
'Node history data'
,
'title'
=
>
'history'
,
'join'
=
>
array
(
'node'
=
>
array
(
'left_field'
=
>
'nid'
,
'field'
=
>
'nid'
,
'type'
=
>
'INNER'
,
)
,
)
,
)
,
'history'
=
>
array
(
'title'
=
>
'Recently viewed'
,
'help'
=
>
t
(
'Only include nodes that have been recently viewed.'
)
,
'filter'
=
>
array
(
'handler'
=
>
'views_handler_filter_recently_viewed'
,
)
,
)
,
'uid'
=
>
array
(
'title'
=
>
'User'
,
'help'
=
>
t
(
'Filter on which user recently viewed items.'
)
,
'relationship'
=
>
array
(
'handler'
=
>
'views_handler_relationship'
,
'base'
=
>
'users'
,
'base field'
=
>
'uid'
,
'label'
=
>
t
(
'user'
)
,
)
,
)
,
'timestamp'
=
>
array
(
'title'
=
>
t
(
'Visit date'
)
,
'help'
=
>
t
(
'The date the node was visited.'
)
,
'field'
=
>
array
(
'handler'
=
>
'views_handler_field_date'
,
'click sortable'
=
>
TRUE
,
)
,
'sort'
=
>
array
(
'handler'
=
>
'views_handler_sort_date'
,
)
,
'filter'
=
>
array
(
'handler'
=
>
'views_handler_filter_date'
,
)
,
)
,
)
;
return
$data
;
}
See Also:
Most recently viewed content in Drupal
history
hook_views_data
views
Submit Fix
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
<?php // $Id$ /** * Implementation of hook_views_handlers(). */ function mymodule_history_views_handlers() { return array( 'info' => array( 'path' => drupal_get_path('module', 'mymodule_history') . '/includes', ), 'handlers' => array( 'views_handler_filter_recently_viewed' => array( 'parent' => 'views_handler_filter', ), ), ); } /** * Implementation of hook_views_data_alter(). */ function mymodule_history_views_data() { $data['history'] = array( 'table' => array( 'group' => 'Node history data', 'title' => 'history', 'join' => array( 'node' => array( 'left_field' => 'nid', 'field' => 'nid', 'type' => 'INNER', ), ), ), 'history' => array( 'title' => 'Recently viewed', 'help' => t('Only include nodes that have been recently viewed.'), 'filter' => array( 'handler' => 'views_handler_filter_recently_viewed', ), ), 'uid' => array( 'title' => 'User', 'help' => t('Filter on which user recently viewed items.'), 'relationship' => array( 'handler' => 'views_handler_relationship', 'base' => 'users', 'base field' => 'uid', 'label' => t('user'), ), ), 'timestamp' => array( 'title' => t('Visit date'), 'help' => t('The date the node was visited.'), 'field' => array( 'handler' => 'views_handler_field_date', 'click sortable' => TRUE, ), 'sort' => array( 'handler' => 'views_handler_sort_date', ), 'filter' => array( 'handler' => 'views_handler_filter_date', ), ), ); return $data; }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp phps
.