2

I created a views block that lists all the content a user has created. I just want this block to appear on the user's profile page, not anywhere else.

User profiles can NOT be found under www.mydomain.com/users/username but under www.mydomain.com/username, so there is not really a way to just display the block on any arg(0)-predefined path.

If I were using Profile2 (which I am NOT, as I haven't figured out a big advantage of Profile2 over the core profile module in combination with the field permissions module yet) I could simply add the contextual filter "Content: NID" and validate with content type "profile". However, my user profiles aren't nodes and so this can't be done.

Is there any way to resolve this issue without using Profile2? All my users will have one profile only and this is really the first time where I would need user profiles to be nodes.

2 Answers 2

1

If you want to display this block only if the path "username" you should use Context.

In the view you have to add the relation on "Author" and then you should have the filter criteria to show contents of the logged user.

With Context you can say "When I'm on the path X then display the block Y in the region Z".

0
0

I'm not familiar with Profile 2, but the way I'd go about this would be to use views_embed_view() on in the user-profile.tpl.php template file. You could base the View's contextual filter off the user's id or username and pass that as the third argument in views_embed_view().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.