show blocks of the mysite user, not currently logged in user

Events happening in the community are now at Drupal community events on www.drupal.org.
mariano.barcia's picture

Hello everybody,

I'm evaluating this module for a large site. Looks good so far, but I want to let users build their page with something like the following:

  • their content (certain types)
  • their buddies' faces
  • their buddies' recent posts
  • their subbed groups
  • the latest posts in their subbed groups

I find it's not easy to build the blocks needed, because there is no argument such as "mysite user ID". There is "currently logged-in user". Buddylist module has a certain integration with a usernode, so you can put a block on the side of a usernode, but that gives you only the profile page (not the mysite page). Do you have a clue how could I do this? I think it would be wonderful to have users build their own page, and get rid of the system's profile page.

Thanks in advance.

Comments

Droplets

agentrickard's picture

In Droplets, you can always return the MySite "owner" UID by using arg(1). If you need to load the full user object, use:

<?php
$uid
= arg(1);
if (
is_numeric($uid)) {
 
$owner = user_load(array('uid' => $uid));
}
?>

Then do whatever you need to using $owner. The MySite code does this frequently.

The path to a MySite page is 'mysite/UID/view'. In Drupal, arg(1) indicates the 2nd element of that path.

The only special case is the "default user" which has the path 'mysite/admin/view' -- so if arg(1) == 'admin' you should pass 0 as the uid.

Take a look also at how profile.inc is written -- it does something very similar.

See also the discussion here: http://drupal.org/node/150081

I also know that Killes was looking to do something similar, so you might ask if you see him in IRC.

--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3

Thanks a lot Agent

mariano.barcia's picture

Thanks a lot Agent Rickard,

I will take a look at profile.inc, but you were right suggesting to take a look at the other thread, as I am more interested in integrating existing blocks from the views module, than having to provide custom code for each block. Cheers,

Mariano Barcia
Colaborativa.net

Company:
http://www.colaborativa.net

Blog:
http://borabora.colaborativa.net

Nuevo:
http://tequejas.com

I have done this

drayen's picture

I can confirm i have done this, to allow facebook like functionality where a user can view another users mysite and see the owner users posts, buddy lists etc.

Once you have the UID of the owner user, you can pass that as a argument to the view/block your creating a droplet from. Then just construct your views/blocks properly and it will work! We currently have this working for a range of droplets from, galleries to custom modules. We have found this so powerful we have opted to also use this technique for blogs and other content areas of mysite - instead of the native mysite method.

You can find me on IRC (#drupal, #drupal-support and #drupal-dojo) quite often, drop me a message if you need some help.

Drayen


acmConsulting.eu


acmConsulting.eu

Drayen

agentrickard's picture

Can you write a new post describing some of these techniques, perhaps with some actual code to share?

--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3

will do

drayen's picture

We haven't got it working for OG's or buddy lists yet (due to complication with the view) but hope to get something sorted by the end of this week... will keep you posted and then make a post when i have something comprehensive.


acmConsulting.eu


acmConsulting.eu

OG Views patch

mariano.barcia's picture

Hello all,

I've made some tests and got OG working for my purposes by extending og_views.inc.

Details and attached files at http://groups.drupal.org/node/7553

Mariano Barcia
Colaborativa.net

Company:
http://www.colaborativa.net

Blog:
http://borabora.colaborativa.net

Nuevo:
http://tequejas.com

MySite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: