Hello, I run an International Forum and I would like to be able to show members location under their Forum names so that other Forum members will know their location. How can I add this?
Thank you for the help,
Charley
Hi @charleyh,
you should customize the topic.php file of the layout you're using.
For example, if you use the wpForo Extended layout you should customize the topic.php file located in the /wpforo/wpf-themes/classic/layouts/1/ folder.
To add the value of the custom field just use this function:
<?php echo wpforo_member($userid, 'CUSTOM_FIELD_NAME') ?>
Just change the red marked code according to the custom field value (in your case location).
Please follow this instruction to customize the wpForo files:
https://wpforo.com/docs/root/forum-themes/theme-customization/
Hey, please can you say where to add this function in topic.php?
wpForo allows you to customize and add the values of the fields under the avatar.
You should customize the post.php file of the layout you're using, and add the new field anywhere you want. See the screenshot below:
For example, if you use the wpForo Extended layout you should customize the post.php file located in the /wpforo/wpf-themes/classic/layouts/1/ folder.
To add the value of the custom field just use this function:
<?php echo implode( ', ', array_diff((array) wpforo_member($member, 'CUSTOM_FIELD_NAME'), array(0)) ) ?>
Just change the red marked code according to the custom field value.
Please follow this instruction to customize the wpForo files:
https://wpforo.com/docs/root/forum-themes/theme-customization/
Also, from where does the custom field value be picked up?
The custom field value comes from the wpForo – User Custom Fields add-on. Once the addon is installed you can start with managing User Fields in Dashboard > Forums > Member Fields admin page. Here you see all available fields. To create the custom field, you just need to click on the [+] button (below all fields). Click on preferred field type on the pop-up window.
More info on how to add custom fields: https://wpforo.com/docs/root/addons/wpforo-user-custom-fields/user-fields-manager/
you should customize the topic.php
Thank you @Alvina confused with the above. Tried topic.php and it didn't work. Now, will try what ever you suggested and will update you here with the result.
To add the value of the custom field just use this function:
Thank @Alvina this worked for me. Was able to show the custom location data below avatar. Will now check with WP User Custom fields and post the update.