Hi! I'm a kind of newbie to Drupal overwhelmed by the complexity required for simple actions... Here's my problem :

Nowhere is mentionned if Profile2 does what the old core module "profile" seemed to do : generating a configurable author information block. I've tried, and nothing like that appears in the block list.

Actually I'm trying to create a block in a different region than the content / main region which would contain some of the displayed node informations : author's name and picture, points, etc...
My configuration : Drupal 7.2

Thks!

Comments

joachim’s picture

Hm I didn't even know about that feature in core!

You can do that if you create a view with a user ID argument and 'default argument' set to 'user ID from node'.

nyoz’s picture

Indeed, I just found this article : http://blog.gesweb.co.uk/drupal-7-create-author-info-block-author-bio-bl...

But once again, I was having a though time trying to find where to implement an "argument" when what was displayed in the Views UI was "Contextual Filters"... But Finally it seems to work...

paulgemini’s picture

Here's what I did in order to create a corresponding author display in a regular node view (not just a PAGE node display, but the default/teaser/full content display):

1. Installed Display Suite and Tokens, and Taxonomy Entity Index (http://drupal.org/project/taxonomy_entity_index).

2. Edited my content type ("Blog Post") and used a 2 column display. The left column is the body, title, tags, links, etc and the right column is for the author display. you can style these with by changing the CSS for .group-right and .group-left. They default to 50% for each side. I set them to 75%-25%. You can also use any other type of Display Suite template.

3. Created custom display suite fields using Tokens. Go to:
Structure -> Display Suite -> Fields -> Add a Field...and then click "Add a field" (again)!
to tie it to a node, under "Entities", check "Node" and in the code section, insert some tokens and text to display whatever you want.

For example, to display "Posted by: Paul Johnson" I used:

Posted by: [node:author:field-first-name] [node:author:field-last-name]

You can add a bunch of custom display suite fields from your Profle 2 fields using tokens. Then you can arrange them in display suite by editing your content type and going to "manage display". Pay close attention to which display you're changing (default? teaser? full content?) or you will be confused. These new custom fields should show up as deactivated in your "manage display" ui. If they don't, you probably didn't click "Node" under "Entity" when you created the custom display suite fields. You probably clicked "User" or "Profile 2" because that sort of makes sense...but it's wrong. Hang your head in shame. Just kidding! I did it the first time.

Now you can take these fields and style them in their little .group-right box. For example: Add a border shadow and a border radius because you just learned CSS3, and then delete it, because it looks stupid [points sheepishly at himself and grins].

This is also a good way to change field labels if you don't like them. Just create a custom display suite field, use tokens to call the field data, and insert your own text. Display Suite comes with a generic "Author" field that displays "Author" without a colon (boo!!!) followed by the username (double boo!!!). I replaced that with "Posted by: [token token"]. But it's nice to be able to change these things.

Can someone confirm that the Taxonomy Term Index (the stop gap until Field Tokens are fixed - see: http://drupal.org/node/691078) allowed me to use these tokens and do this? If not, I probably just did it with plain old Token.

Scatterspell’s picture

There is a module for that for D7 now. http://drupal.org/project/author_pane

It's still a .dev but it works for basics. Now lets hoping they give us a config menu outside the block config so we can really customize it without having to dig into changing it programatically.

hedel’s picture

Author pane don't give many options for configurate, and if is necesary go to code for modiffy the module, is more ease add the block in the node.tpl that be using more modules...
The solution by #3 is really good, very flexible...

Only add to his explain that the tokens you must use are under: node > author > profile:X >...

ScottProck’s picture

Version: 7.x-1.0-beta4 » 7.x-1.2
Component: Documentation » Miscellaneous

I have tried to follow #3 but for some reason I can't get the profile2 tokens to print. All other tokens print fine, but nothing displays if I use any token related to profile2.

As an example, when completing step 3 ... I clicked the check box to use tokens, then clicked the tokens list to display the available tokens and clicked [profile2:field-author-bio] to use the author bio field in the profile content. Nothing displays ... so I added some text in front of the token to see if the code was working. I now have the added text showing up, but again, nothing printed from the token. Tokens from anything other than profile2 work.

Something else I am struggling with, when editing the views settings for the content, I noticed the only option I can use is the Display Suite format ... if I choose the Display Suite Fields the only fields available are from the "content" style. In fact, the only way I can get any fields from the profile2 module, is if I set the view up using Profiles instead of content.

Is it possible my theme is missing a pre-process or something that would allow the tokens from profile2 to be recognized? I've been struggling for several days to figure out what I am doing wrong.

Thanks

ali_b’s picture

I have exactly the same problem...
But finally I found out how to do it:
1. Make new view of type "profiles"
2. create a block
3. do not use "relationship"
4. for contextual filter, use "Profile: User uid".... When the filter value is NOT available: Provide default value: USer ID from URL
and check: Also look for a node and use the node author
5. configure profile fields you want to display

JohnnyW’s picture

Issue summary: View changes

Thanks, Ali_B ;)