Jump to content

How to display custom field in post bit?

Featured Replies

Posted

I have created a custom field, how do I display it's value in post bit?

  • Author

:)

  • 4 months later...
  • Author

Bump...

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.

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).

Edited by Arai

  • Author

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?

Edited by Kirill N

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 :) 

  • Author

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

@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 :) 

  • Author

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!

  • Author

@Rikki, how do I show the display format of the field, instead of raw?

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:

  • Author

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.

  • Author

@Rikki, how do I show the display format of the field, instead of raw?

@Rikki ? (in case you missed it)

Archived

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

Recently Browsing 0

  • No registered users viewing this page.