0

I have blocks for several profile types that links to users photos videos etc. (think myspace)

With arguments it works nice, block is visible only on page created by userXY and leads to other content made by userXY.

But, when userXY logs into his account and goes to "My account" it leads to www.example.com/user

Now blocks from all profile types are visible and they lead to false urls. The correct block is also there and works well but i can't find a way to limit other blocks not to be shown here.

I am using profile2, tokens and real name module.

Other problem which was thinking of to solve the issue was to change pattern for /user into /role/realname or anything that will change from default /user but nothing seems to work (pattern is ignored).

2 Answers 2

0

I think you have 2 main options:

You can use some custom PHP to control the blocks visibility. Something like:

global $user;
$account = user_load($user->uid);
if($account->profile_type[LANGUAGE_NONE][0]['value'] == 'some value') return true;
return false;

Or I think this is a good use case for the Context module. This allows you to create different "contexts" that your blocks should appear in. An example from the Context help file says:

You want to create a "pressroom" section of your site. You have a press room view that displays press release nodes, but you also want to tie a book with media resources tightly to this section. You would also like a contact block you've made to appear whenever a user is in the pressroom section.

  1. Add a new context on admin/build/context
  2. Under "Conditions", associate the pressroom nodetype, the pressroom view, and the media kit book with the context.
  3. Under "Reactions > Menu", choose the pressroom menu item to be set active.
  4. Under "Reactions > Blocks", add the contact block to a region.
  5. Save the context.
0

In the end i made 2 identical blocks in views, one to show only on /user* and other to show everywhere else where it is in relationship with user-role type except /user*

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.