2

I am working on a directory for a membership organization.

I am trying to create two distinct user pages. One for the user themselves (and admins) and one for the public to view. I would like these formatted differently, not just show different fields (which I could do simply with permissions, right?). And these public pages need to include Profile2 profile data.

I have tried editing the user-profile.tpl.php page. For example:

<div class="profile"<?php print $attributes; ?>>

  <?php print render($user_profile['field_first_name']); ?>
  <?php print render($user_profile['field_last_name']); ?>

</div>

...but this seems to have no effect on the user page at all, even when I clear all caches. (Perhaps because I'm using Display Suite to layout the user profile page? Does that override everything else?)

I also created a View:

  • Contextual Filter

    • User:Uid
    • Provide default value: Type = User ID from URL
    • Specify validation criteria: Validator=User
  • Relationship

    • User:Profile
    • Profile types (all 3 custom profile types chosen)
  • Path: /users/%user

But I'm still just getting the Display Suite layout. Is that doing the override?

1

DS uses it's own templates. Go to admin/config/people/accounts/display, then scroll to the bottom and DS will show you which templates you can use to overwrite the output.

In the example below there are 2 suggestions. Hope this helps you out.

enter image description here

  • Yes, this is helpful. Thank you Robin. I have a couple questions, since I'm new to template stuff. – Christopher Dunning Jan 18 '15 at 18:04
  • I found the "ds_2col.tpl.php" file and made a copy of it and renamed it "ds-2col--user.tpl.php". 1. Where does this file go? Leave it inside the display suite layouts folder or move it to my theme folder? 2. I looked at the file and can't figure out what I can do to edit it. It appears that there are two variables coming from somewhere else. The left column = "<?php print $left; ?>", and the right column = "<?php print $right; ?>" Where is DS getting those variables "$left" and "$right"? Or am I looking in the wrong place to edit? – Christopher Dunning Jan 18 '15 at 18:12
  • Also, once I edit the user profile template, any ideas how to have different formatting for the users and the public? – Christopher Dunning Jan 18 '15 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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