How to show 'Activity' in the profile page?

minesota - June 28, 2008 - 00:38
Project:Advanced Profile Kit
Version:5.x-1.0-alpha4
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

The "Add content" pane has already "Activity: Mine: show the current user's activity." - however this shows the activity of the logged in user (that is, my activity) rather than whose profile I am seeing. Please, can some clue be kindly provided or some code snippet that can be added to custom, so that activity of the profile owner is seen ( with a more link or a fixed 'x' number of activities) ?

Trying with the below but this gives a blank only:

<?php
$uid
= arg(1);
$profileuser = user_load((array('uid' => $uid)));
$activities  = $profileuser->activity;

$activities = activity_get_activity($user->uid, NULL, 20);
   
$table = activity_table($activities);
   
$feed_url url('activity/'. $user->uid. '/feed');
   
drupal_add_feed($feed_url);
   
$feed = theme('feed_icon', $feed_url);
    return
theme('activity_page', $activities, $table);


?>

#1

Utternonsense - June 28, 2008 - 12:02

minesota

I was also tearing my hair out with this problem but I think I may have fixed it using this code that comes with the Buddylist 'buddylist_api_buddylist' View:

global $user;
// Make the first argument the uid of the current user if not already set
if(arg(0) == "user" && is_numeric(arg(1))){
$args[0] = arg(1);
}else{
$args[0] = $user->uid;
}
return $args;

I built a block list view and used

User: UID is Author

as the Argument and put the above code into the Argument Handling Code box.

I then placed that View into the pane on my Adv Profile page and now when I visit another users page I see only the posts made by that user rather than my own posts.

I also set the value of the Argument to 'Use Empty Text' for users who haven't posted anything yet.

As I said, it seems to be working but I'm wary enough of counting my chickens with Drupal as it is so I can only say I hope it works for you :)

AttachmentSize
myactivity_view.png68.58 KB

#2

minesota - June 29, 2008 - 04:45

Hi Ultranonsense, thanks a lot. Can you kindly say
what to add in the "add field" area and how many fields to be added ?

#3

Michelle - June 29, 2008 - 15:19
Status:active» duplicate

Don't know when I'll get back to making this work, but the issue is here: http://drupal.org/node/210987

Michelle

 
 

Drupal is a registered trademark of Dries Buytaert.