Notifications
Clear all

wpForo 1.x.x [Solved] How do I ad Member Locations?

8 Posts
5 Users
5 Reactions
2,969 Views
Posts: 5
Topic starter
(@charleyh)
Active Member
Joined: 5 years ago

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

https://radicalsportscarregistry.com/radicalforum/

7 Replies
Sofy
Posts: 4872
 Sofy
Admin
(@sofy)
Support Team
Joined: 7 years ago

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/

 

1 Reply
(@sreek)
Joined: 5 years ago

Active Member
Posts: 15

@sofy @Robert

Hey, please can you say where to add this function in topic.php? Also, from where does the custom field value be picked up? Can Wp User custom field value be showed below avatar image?

Tried adding this line in the topic.php, but didn't reflect. 

Any help? 

Alvina
Posts: 1862
Moderator
(@alvina)
Member
Joined: 5 years ago
Posted by: @sreek

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/

Posts: 15
(@sreek)
Active Member
Joined: 5 years ago
Posted by: @sofy

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.

1 Reply
Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@sreek,

Ok, please keep us informed.

Posts: 15
(@sreek)
Active Member
Joined: 5 years ago
Posted by: @alvina

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.  

Page 1 / 2