Posted by oskar_calvo on July 4, 2009 at 11:08am
hello. I want to add one tab in the users page, in this tab i want to show some information from buddylist module.
The problem is that users only can see his/her own tab, but not other users tab. I'd like that users can see other users buddys activitys
<?php
/**
* Implementation of hook_perm().
*/
function buddysactivity_perm() {
return array('my buddys activity');
}
/**
* Implementation of hook_menu().
*/
function buddysactivity_menu($may_cache) {
$items = array();
if ($may_cache) {
if (arg(0) == 'user') {
$items[] = array(
'path' => 'user/'. arg(1) .'/buddy',
'title' => t('my buddys activity'),
'callback' => 'my_buddy_activity',
'callback arguments' =>array('user', arg(1)),
'access' => user_access('my buddys activity'),
'type' => MENU_LOCAL_TASK,
);
}
}
return $items;
}
/*
*
*submit de la información.
*
*/
function my_buddy_activity (){
$pared = '<div id="pared"><ul>';
if ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == 'buddy'))
{ $arg1 = arg(1);}
$query="SELECT a.buddy, u.name, u.picture, n.created, n.title, n.nid, n.status
FROM {users} u, {buddylist} a, {node} n
WHERE u.uid = a.buddy
AND a.uid =%d
AND a.buddy = n.uid
AND n.status =1
order by n.created DESC";
$result = db_query_range($query, $arg1, 0, 30);
while ($data = db_fetch_object($result)) {
$pared .= '<li>
<a href="'.base_path().'node/'.$data->nid.'" alt="'.$data->title.'" title="'.$data->title.'">
'.$data->title.'
</a>'. t('by') .' <a href="'.base_path().'user/'.$data->buddy.'" title="'.$data->name.'" alt="'.$data->name.'">'.$data->name.'</a>';
}
$pared .= '</ul></div>';
return $pared;
}
?>Also, i'm using also bio node in user page and i18n, but I thinks this is not the problem.
Thanks
Oskar