Hi Michelle.

Could you possibly export your view that allows your panels to display only the content created by the user? The UserProfile panel has the context User ID and relationship node from user...but then I create a view and it doesn't pass the argument on to the view...as the view still contains all the content, not just the content created by the user who's profile I'm looking at.

How do you create a panel that displays say all the posts by the profiled user? Are you creating the view with arguments? or adding the arguments through the panel?

Comments

michelle’s picture

If you have the module, you have the view. For reference: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/advanced_pr...

I just created a view that takes the UID as an argument, added it to the panel, and put %1 in for the argument.

Michelle

thomasmuirhead’s picture

Status: Active » Fixed

Thank you Michelle

What I needed was the %1....now I'm starting to understand it. Thank you so much.

to clarify for others here's a simple HowTo. I don't know where, or how, to add it to the documentation, so I'll just add it here.

Adding a view of a user's blog to their profile page using Advanced Profile.

If you want to add a view with a list of each user's blogs to that user's userprofile. (obviously, you must have blogs as a content type, views, advprofile, panels 2 etc)

1. Go to Views.

2. Add view

3. Give it a name, say usersblog

4. Give it a description, say user blogs for profile page

5. Open page section and check the 'Provide Page View' box.

6. Give it a url, say usersblogs

7. Choose List Type (or customise to the type of your choosing)

8. Give it the title %user's blogs (the %user will give it the username of the profile page)

9. Check the pager box

10. Choose 5 nodes per page

11. Jump to the 'Fields' section

12. Choose 'Node: Title' from the drop down and press 'Add Field'. This will display the title of the blog. (you can add whatever fields you want to show, and their order by using the arrows on the right)

13. Open the 'Arguments' section. Choose 'User: UID is Author' from the drop down and click 'Add Argument'.

14. Open the 'Filters' section. Choose 'Node Type' from the drop down and click 'Add Filter'. (The filter makes sure the only content displayed is a blog)

15. In the newly added 'Node Type' field, choose 'Is One Of' and 'Blog Entry' from the menus.

16. Open the Sort Criteria section. Choose 'Node: Created Time' from the drop down and press 'Add Criteria'. (This means that it will sort the nodes displayed by the time the node was created.)

17. In the newly added 'Node: Created Time' field, choose 'Descending' so it shows them in latest created order.

18. Save your view.

19. Go to the Panel Pages: /admin/panels/panel-page

20. If you've installed Advanced Profile correctly you should have a UserProfile Panel Page. Click 'Edit'.

21. Ignore the rest of the tabs for the moment and click 'Content'

22. You can put the blog list wherever you want, but for now we'll add it to the 'Left' panel underneath the Activity pane.

23. Click the plus side on the top left of the 'Left' pane.

24. In the pop up, scroll down to the Views, find '%user's blog' and click it.

25. On the 2nd page of the pop up. Check the box: 'Provide a "more" link that links to the view'

26. Check the box: 'Send Arguments'

27. In the Arguments field add: %1

28. Click Add Pane.

29. Back on the Panels page, you'll see the new pane has appeared and has a yellow title background instead of a blue one. This means it hasn't been saved. So press the Save button at the bottom of the page.

30. Have a look at your profile, there should be a pane with a list of your 5 most recent blog posts.

michelle’s picture

Title: panels and context » How to: Add the user's blog to their profile
Status: Fixed » Active

Actually, I was planning on adding this to advprofile but forgot to make a task for it. But this how to is great until I get to it. I changed the title and set it back to active. Once it's included, I'll set it to fixed again.

Thanks,

Michelle

michelle’s picture

I attempted to add a blog pane but I've run into all sorts of weird errors. Views and blogs aren't getting along well. So this is still on my to do list.

Michelle

sterwa’s picture

Here I am exporting a view that works for me to display latest user's blog posts

  $view = new stdClass();
  $view->name = 'user_tracker_blog';
  $view->description = 'Shows blog posts started by or participated in by a given user';
  $view->access = array (
);
  $view->view_args_php = 'global $user;
// Make the first argument the current user if not already set
if (!$args[0]) {
  $args[0] = $user->uid;
}
';
  $view->page = TRUE;
  $view->page_title = 'My blog posts';
  $view->page_header = '';
  $view->page_header_format = '4';
  $view->page_footer = '';
  $view->page_footer_format = '4';
  $view->page_empty = 'No posts found.';
  $view->page_empty_format = '4';
  $view->page_type = 'teaser';
  $view->url = 'user/$arg/blog';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '15';
  $view->sort = array (
    array (
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'uidtouch',
      'argdefault' => '7',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Title',
      'handler' => 'views_handler_field_nodelink_with_mark',
      'options' => 'link',
    ),
    array (
      'tablename' => 'users',
      'field' => 'name',
      'label' => 'Poster',
    ),
    array (
      'tablename' => 'node_comment_statistics',
      'field' => 'comment_count',
      'label' => 'Replies',
      'handler' => 'views_handler_comments_with_new',
    ),
    array (
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'label' => 'Updated',
      'handler' => 'views_handler_field_since',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'blog',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node_comment_statistics, node, users);
  $views[$view->name] = $view;
michelle’s picture

Status: Active » Fixed

I forgot about this issue. There's been a view pane for the blog posts in there a while.

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

dmetzcher’s picture

I'm totally confused here...

Michelle said: "There's been a view pane for the blog posts in there a while."

Where is this pane? How can I add it to a user's profile page (using Panels and APK)? Sorry if the answer is obvious, but I simply cannot figure it out. All I want is a simple pane on the profile page that displays only the blog posts by a given user (say, the five most recent) and a "more" link that goes to the page with all their blog entries.

Thanks! :-)