How to Display Profile Field in the Topic Template
-
I have a profile field.. that I want to display in the topic template…
How do I do it? `get_profile_data` doesn’t work
-
I’m trying to pass the current poster ID for the forums.., but it’s NOT WORKING!!! with the get_profile_data
Bump
BUMp again
Im looking for this tooo
bump
wow…. why won’t anyone answer me?
bump again
I’m going to keep bumping until someone answers me
Rather than simply bumping and waiting for someone why don’t you try a generally accepted tech forum approach of actually explaining what you are trying to do in a code sense with examples of what you have tried to date that has or hasn’t worked, this way you are more likely to get a response from developers if they can see your working, your approach and suggest ways of achieving what you want to do. Your post simply lacks any detail and begs a whole heap of questions before anyone could begin to help.
I would also suggest you start over as few are likely to look past this many ‘bumps’
why can’t you help me?
guess I’m back to bumping!
bump
bump
Check out the bp_profile_field_data() function (located in bp-xprofile/bp-xprofile-templatetags.php):
https://buddypress.trac.wordpress.org/browser/tags/1.2.8/bp-xprofile/bp-xprofile-templatetags.php#L551It takes “user_id” as a parameter.
Since you’re referring to the topic template, you’ll need to use a custom function to grab the topic poster ID since a native one doesn’t exist in BP at the moment. Here’s a post I made awhile back that will help:
https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-display-the-user-post-count-in-topic-php#post-92596Also luvs, be aware that the people who post on these support forums are volunteers who take time out of their day to help the community.
So…. something like:
“
*update** the code I tried above ^^ does not work.
I also tried:
`function profile_field_topic( $args = ” ) {
global $topic_template;$defaults = array(
‘field’ => false, // Field name or ID.
‘user_id’ => $topic_template->post->poster_id
);$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );return apply_filters( ‘bp_get_profile_field_data’, xprofile_get_field_data( $field, $user_id ) );
}`
but no go…
Your first example code is closer, but you need to put those parameters in an array:
`bp_profile_field_data( array( ‘field’ => FIELDID, ‘user_id’ => my_topic_poster_id() ) );`
Uhh it sort of worked how I wanted. I want to have an image associated with the profile field, so the field is a link when clicked. But I only want the image to appear if the user has filled it out: so I tried:
` 66, ‘user_id’ => my_topic_poster_id() ) ) ) : ?>
<a href="”>
`but all it does is display the link, not the image. What am I doing wrong?
Nevermind! Changed it to `bp_get_profile_field_data(` and it worked, thanks!
Please someone should help me out on my topic. Thanks
- The topic ‘How to Display Profile Field in the Topic Template’ is closed to new replies.