Jump to content

How to display custom field in post bit?


Kirill N

Recommended Posts

  • 4 months later...

Sorry for hi-jacking, but Rikki what would it look like (full string) to have those fields displayed in the topics/posts?

I think that's what the OP is interested in, as am I (not sure what title/content means).

Link to comment
Share on other sites

When you create/edit the field in the ACP, there's a field called "Display format". Enter something like:

<strong>{title}:</strong> {content}

You can customize this as you see fit.

Thanks Rikki, but that's not exactly what I mean. 

All the custom fields are displayed using this bit:

{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}

But it lists ALL the exisiting custom fields in a list. This is very inconvenient and very limiting.

For example, I just created a custom field for members' Twitter accounts and I want to display it next to their username. How do I call that particular custom field?

Link to comment
Share on other sites

Sorry for hi-jacking, but Rikki what would it look like (full string) to have those fields displayed in the topics/posts?

I think that's what the OP is interested in, as am I (not sure what title/content means).

You'd enter exactly what I pasted - the {title} and {content} get replaced automatically when a user views a post :) 

Link to comment
Share on other sites

@Rikki In other words, is it possible to call one custom field instead of a list of all the existing ones?

Try something like this. Given a member object (in postContainer, it's $comment->author()), do:

{{$fields = $comment->author()->profileFields();}}
{$fields['core_pfieldgroups_<group_id>']['core_pfield_<field_id>']|raw}

You'll need the ID of the field group and the field ID and insert them in the correct spot - you can find them in the AdminCP or by looking at your database :) 

Link to comment
Share on other sites

Try something like this. Given a member object (in postContainer, it's $comment->author()), do:

{{$fields = $comment->author()->profileFields();}}
{$fields['core_pfieldgroups_<group_id>']['core_pfield_<field_id>']|raw}

You'll need the ID of the field group and the field ID and insert them in the correct spot - you can find them in the AdminCP or by looking at your database :) 

Worked like a charm, thanks a lot Rikki!

Link to comment
Share on other sites

Are you just trying to display custom profile field information in the left hand user pane in a topic? If so then it's just a matter of entering in some code as per my post below. Check out the code I'm using in "Display format". I use similar code to display a number of custom profile fields e.g. software version:

Link to comment
Share on other sites

Are you just trying to display custom profile field information in the left hand user pane in a topic? If so then it's just a matter of entering in some code as per my post below. Check out the code I'm using in "Display format". I use similar code to display a number of custom profile fields e.g. software version:

Not quite.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...