Advanced Forum and Author Pane are installed on my site, hense Author Pane is shown in the comments to forum and to site. Then installed Countries module and added country field to user registration form. Installed Country icon module and in the country choise field added also country flag. In the forum file 'advanced_forum.silver_bells.author-pane.tpl.php ' indicated this field:

<span class="autorflag"><?php if (isset($account->field_country_user['und'])) 
       print render(field_view_value('user', $account, 'field_country_user', $account->field_country_user['und'][0])); ?></span>

The field is indicated but now I have to indicate a flag too (country icon). How should I change the code to indicate the flag?

CommentFileSizeAuthor
#2 format.png14.74 KBfuntik44

Comments

johnv’s picture

Please check the formatter options of the field. No need for coding!

funtik44’s picture

StatusFileSize
new14.74 KB

Yes I know it and I did it but nothing changes. In user info this field displaying with icon flag, but in Author Pane displaying without the flag.

Rustan’s picture

Status: Active » Fixed

If your field is called "field_profile_country", do this in your advanced-forum-post.tpl.php:

<?php print render(field_view_field('user', $account, 'field_profile_country', 'teaser')); ?>

alan d.’s picture

@Rustan solution is correct (almost).

In D7 the signature is:

function field_view_field($entity_type, $entity, $field_name, $display = array(), $langcode = NULL);

where $display is either the display settings (not recommended) or the view mode that uses the correct display with the name and icon. Just make sure that your referenced view mode exists, "full" is the only user bundle view mode defined by core.

If you really want to get your hands dirty, you can call this directly, but as an internal API, it may change without notice:

$variables = array(
  'country' => $item['country'],
  'settings' => array(
    // TYPE either sprite or icon, see the country icon module for ICONSET names.
    'countryiconset' => 'TYPE_ICONSET', 
    'property' => 'name',
  ),
);
print theme('country_icon_adapter', $variables);

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

roball’s picture

Category: task » support
Status: Closed (fixed) » Active

I have installed the modules Countries 7.x-2.1, Country Icons 7.x-2.0-beta1 and (Country Icons) Shiny iconset 7.x-2.x-dev.

In a Profile 2 profile, I have added a field of type Country with the widget Select list. Under the Manage display tab, I have selected the Country Icon formatter. However, this resulted in displaying the message "Missing icon or spirte plugin" next to it.

Can you please give instructions on how to display a country with its icon?

Thanks.

alan d.’s picture

Hi Rob, this sounds like a bug. I can have a play in the next couple of days to see if I can replicate.

As an aside, it is best to open a new issue rather than reopening old ones unless they are directly related :)

roball’s picture

Status: Active » Fixed

Hi Alan,

thanks for the prompt reply! I have opened a dedicated issue for this probable bug now:
#2050939: "Country Icon" formatter gives error "Missing icon or spirte plugin"
You are right, it's better to discuss the problem there. So I am re-closing this issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.