Notifications
Clear all

[Solved] How to turn off Topic Custom Fields for certain forums (by ID)

1 Posts
1 Users
0 Reactions
1,140 Views
Astghik
Posts: 6153
Admin
Topic starter
(@astgh)
Illustrious Member
Joined: 7 years ago

If you want to turn off Topic Custom Fields for certain forums (by ID) follow the steps below:

1. Open the /wp-content/plugins/wpforo/wpf-includes/class-posts.php file

2. Find the following line:

public function get_topic_fields($forum, $values = array(), $guest = false ){

3. insert the code below after the line mentioned above (in step 2)

$only_defaults = in_array( $forum['forumid'], array(X) );

X is a forum ID, where you need to hide the topic custom fields. Comma-separated all form IDs where you need to hide those. For example, if you want to hide the fields from the forums with 7, 8, 25 ID use the code below:

$only_defaults = in_array( $forum['forumid'], array(7, 8, 25) );

4. Replace the code in the next line :

$fields = $this->fields_structure_full_array( $this->get_topic_fields_structure(false, $forum['cat_layout'], $guest), $used_fields );

with the following one:

$fields = $this->fields_structure_full_array( $this->get_topic_fields_structure($only_defaults, $forum['cat_layout'], $guest), $used_fields );

Important:

We do all our best to include the feature in the addon ASAP. This is just a temporary solution. You'll lose the changes once you update the wpForo plugin. 

Just make sure the version is higher than 1.8.4. 

Share:
Scroll to top