Commit 6172d5d4 authored by robertDouglass's avatar robertDouglass

reinstating HEAD

parent 8039b592
Readme
------
This module allows users to put each other on a personal 'Buddy List'.
Where is the module???
Features include buddy groups and the ability to track your buddies' recent posts.
You're looking at the CVS version of the buddylist module. It doesn't exist.
Send comments to Robert Douglass at: http://drupal.org/user/5449/contact
Available versions are:
DRUPAL-4-5
DRUPAL-4-6
DRUPAL-4-7
DRUPAL-5-0
Requirements
------------
This module requires Drupal 4.7.
As of this writing, all of the 4-* versions can be downloaded from the modules page:
http://drupal.org/project/Modules
This module does not yet offer PostgreSQL support. If you would like to contribute to this module by creating the appropriate PostgreSQL schema, please submit your code at http://drupal.org/project/issues/buddylist
The DRUPAL-5-0 modules aren't being tarballed yet (October 25, 2006), so you have to get that version straight from CVS:
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib co -d buddylist -r DRUPAL-5-0 contributions/modules/buddylist
Upgrading from 4.6
------------------
WARNING: There is currently no migration path from 4.6 to 4.7. There are significant database schema changes and the 4.7 module will not work with the 4.6 schema. A migration path is forthcoming. If you need one sooner, contact me: http://drupal.org/user/5449/contact
Why no CVS version?
Installation
------------
1. Copy the buddylist.module to the Drupal modules/ directory.
It is the least useful version that Drupal has. If you are actually honestly maintaining your module against the CVS development branch of Drupal, fine, have a CVS version of your module. The typical case is much uglier, however, and has led to our cvs repository being horribly disorganized. The typical case is that a module author wants to check in a new module and learns just enough CVS to get it into the repository, without a tag. Thus you find modules in the CVS repository, without tags, that are intended to be used with every imaginable flavor of Drupal. It is a mess.
2. Enable buddy list in the "site settings | modules" administration screen.
On the other hand, a tagged version of a module is clear; use this version with DRUPAL-*-*. Furthermore, at this time, the development branch of Drupal core IS DRUPAL-5-0. When the development branch is opened up again after the 5-0 release, if someone is interested in chasing it with the buddylist, we'll reinstate the untagged "CVS" version of buddylist.
Enabling the buddylist module will trigger the creation of the database schema. If you are shown error messages you may have to create the schema by hand. Please see the database definition at the end of this file.
3. Enable buddy list blocks you want in the "blocks" administration screen.
4. Optionally add the following theme function to your PHPTemplate's template.php file:
function phptemplate_username($object) {
global $user;
/* Use the default theme_username for anonymous users, nodes by this user */
if ($user->uid == 0 || $object->uid == $user->uid || $object->uid == 0) {
return theme_username($object);
}
if (!user_access('maintain buddy list')) {
return theme_username($object);
}
/* an array, keyed on buddy uids */
$buddies = buddylist_get_buddies($user->uid);
/* Find out if this buddy is in the user's buddy list */
foreach ($buddies as $buddyuid => $buddystructure) {
if ($buddyuid == $object->uid) {
$output .= theme_username($object);
$output .= ' (';
$output .= theme('remove_from_buddylist_link', $object);
$output .= ')';
return $output;
}
}
/* The user is not in the buddylist, give a link to add */
$output .= theme_username($object);
$output .= ' (';
$output .= theme('add_to_buddylist_link', $object);
$output .= ')';
return $output;
}
Database Schema
---------------
If the automatic creation of the database tables was unsuccessful you can try creating the tables by hand using the following SQL:
CREATE TABLE `buddylist` (
`uid` int(10) unsigned NOT NULL default '0',
`buddy` int(10) unsigned NOT NULL default '0',
`timestamp` int(11) NOT NULL default '0',
`received` tinyint(1) NOT NULL default '0',
UNIQUE KEY `uid-buddy-label` (`uid`,`buddy`),
KEY `uid` (`uid`)
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
--
-- Table structure for table `buddylist_buddy_group`
--
CREATE TABLE `buddylist_buddy_group` (
`uid` int(11) NOT NULL default '0',
`buddy` int(11) NOT NULL default '0',
`label_id` int(11) NOT NULL default '0',
PRIMARY KEY (`uid`,`buddy`,`label_id`)
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
--
-- Table structure for table `buddylist_groups`
--
CREATE TABLE `buddylist_groups` (
`uid` int(11) NOT NULL default '0',
`label_id` int(11) NOT NULL default '0',
`label` varchar(255) NOT NULL default '',
`visible` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`uid`,`label_id`)
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
Credits
-------
Written by Adrian Rossouw.
Thanks to Ratko Kovacina for the comments/debugging info
Browsing improvements by Doug Sikora
Maintainer: Robert Douglass
Status: maintained (Feb. 2006)
TODO
----
1. PGSQL schema (see buddylist.install, buddylist_install())
2. Rework texts so that one is not stuck with "buddy" but could choose "contact", for example
3. Make a workflow whereby a buddy request is sent to the buddy for confirmation which is required before the buddy can be added.
4. Make the notification that someone added you to their buddylist use the privatemsg module, if available.
5. Consider possible Views module integration.
\ No newline at end of file
; $Id$
name = Buddylist
description = Users add other users to their buddylists.
package = Social networking
\ No newline at end of file
<?php
// $Id$
/**
* Install the initial schema.
*/
function buddylist_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$query1 = db_query("
CREATE TABLE {buddylist} (
uid int(10) unsigned NOT NULL default '0',
buddy int(10) unsigned NOT NULL default '0',
timestamp int(11) NOT NULL default '0',
received tinyint(1) NOT NULL default '0',
PRIMARY KEY (uid,buddy)
) /*!40100 DEFAULT CHARACTER SET utf8 */;");
$query2 = db_query("
CREATE TABLE {buddylist_buddy_group} (
uid int(11) NOT NULL default '0',
buddy int(11) NOT NULL default '0',
label_id int(11) NOT NULL default '0',
PRIMARY KEY (uid, buddy, label_id)
) /*!40100 DEFAULT CHARACTER SET utf8 */;");
$query3 = db_query("
CREATE TABLE {buddylist_groups} (
uid int(11) NOT NULL default '0',
label_id int(11) NOT NULL default '0',
label varchar(255) NOT NULL default '',
visible tinyint(1) NOT NULL default '0',
PRIMARY KEY (uid, label_id)
) /*!40100 DEFAULT CHARACTER SET utf8 */;");
if ($query1 && $query2 && $query3) {
$created = TRUE;
}
break;
}
if ($created) {
drupal_set_message(t('Buddylist module installed successfully.'));
}
else {
drupal_set_message(t('Table installation for the Buddylist module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries.'), 'error');
}
}
function buddylist_update_1() {
return _system_update_utf8(array('buddylist'));
}
This diff is collapsed.
<?php
// $Id$
/**
* This include file implements views functionality on behalf of the
* buddylist.module
*/
function buddylist_views_tables() {
$tables['buddylist'] = array(
"name" => "buddylist",
"join" => array(
"left" => array(
"table" => "users",
"field" => "uid",
),
"right" => array(
"field" => "buddy",
),
),
);
$tables['buddylist_users'] = array(
'name' => 'users',
'join' => array(
'left' => array(
'table' => 'buddylist',
'field' => 'uid'
),
'right' => array(
'field' => 'uid'
),
),
'fields' => array(
'name' => array(
'name' => t('Buddylist: User Name'),
'handler' => 'views_handler_field_username',
'sortable' => true,
'uid' => 'uid',
'addlfields' => array('uid'),
'help' => t('This will display the username of the owner of the buddylist.'),
),
'uid' => array(
'name' => t('Buddylist: User Picture'),
'handler' => 'views_handler_field_userpic',
'sortable' => false,
'help' => t('This will display the user picture of the owner of the buddylist.'),
),
),
'sorts' => array(
'name' => array(
'name' => t('Buddylist: Buddy Name'),
'help' => t('This allows you to sort alphabetically by buddy name.'),
)
),
'filters' => array(
'uid' => array(
'name' => t('Buddylist: Author Is A Buddy Of Username'),
'operator' => 'views_handler_operator_or',
'list' => 'views_handler_filter_username',
'value-type' => 'array',
'help' => t('This allows you to filter by buddies of a particular user.'),
),
'currentuid' => array(
'field' => 'uid',
'name' => t('Buddylist: Author Is A Buddy Of Current User'),
'operator' => 'views_handler_operator_eqneq',
'list' => 'views_handler_filter_usercurrent',
'help' => t('This allows you to filter by buddies of the current user.'),
'cacheable' => 'no',
),
),
);
return($tables);
}
function buddylist_views_default_views() {
$view = new stdClass();
$view->name = 'buddylist';
$view->description = 'A list of nodes created by buddies of current user';
$view->access = array ();
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Buddylist Content';
$view->page_header = 'Nodes authored by buddies of current user<BR />';
$view->page_header_format = '4';
$view->page_footer = '';
$view->page_footer_format = '4';
$view->page_empty = '';
$view->page_empty_format = '4';
$view->page_type = 'table';
$view->url = 'buddies';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->sort = array (
array (
'tablename' => 'node',
'field' => 'created',
'sortorder' => 'DESC',
'options' => '',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'users',
'field' => 'name',
'label' => 'Buddy',
),
array (
'tablename' => 'node',
'field' => 'title',
'label' => 'Node Title',
'handler' => 'views_handler_field_nodelink',
),
array (
'tablename' => 'node',
'field' => 'type',
'label' => 'Node Type',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'buddylist_users',
'field' => 'currentuid',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_USER***',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, users, buddylist_users);
$views[$view->name] = $view;
return($views);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment