This include file for the modules Views (/modules/views/modules/views_userlink.inc) implements views functionality for userlink.module.

/**
 * $Id: views_userlink.inc,v 1.10 2006/06/21 12:01:19 chris_five Exp $
 */
function userlink_views_tables() {
  if (module_exist('userlink')) {

	$tables['userlink'] = array(
		'name' => 'userlink',
		'provider' => 'internal',
    'join' => array(
      'left' => array(
        'table' => 'node',
        'field' => 'nid'
      ),
      'right' => array(
        'field' => 'nid'
      ),
    ),
		'fields' => array(
			'url' => array(
				'name' => t('Userlink: URL'),
				'handler' => 'views_handler_userlink_url',
				'sortable' => false,
				'help' => t("The URL field will display the URL of a userlink node (for example, 'http://www.drupal.org')")
				),
		)
	);
	return $tables;
	}
}

function views_handler_userlink_url($fieldinfo, $fielddata, $value, $data) {
	return l($value, $value);
}

Based on work by vadbars (http://drupal.org/node/68931)

Comments

diego_miola’s picture

You must replace "module_exist" function to "module_exists" in order to make this snippet work on Drupal 5.

http://drupal.org/node/64279#module-exists

Diego.

roychri’s picture

The latest version of userlink module (5.x-1.2) already support integration with views.
Using the code in this page will result in Fatal error: Cannot redeclare userlink_views_tables()

abir16’s picture

Oh, I remember facing this problem when building file upload web service.
Thank you for this post.