By default, the search will be done through all the available forums. Using the filter ‘gdpos_allowed_forums_ids_list‘ you can control list of allowed forums.

This filter provides 1 argument only.

Arguments

  • $list: empty array as a placeholder

Important

There are a few things you need to know:

  • This filter is fired when the form is generated to populated forum selection and when the search query is created.
  • If you have forum hierarchy, you need to list exact ids for forums and subforums you want to include.
  • You can use conditional functions inside the filter function – for instance, to get a user ID and build a list of forums for individual users.

Example #1

This example will allow a search through forums with ID’s listed in line 3.

add_filter('gdpos_allowed_forums_ids_list', 'custom__gdpos_forums_ids_list');
function custom__gdpos_forums_ids_list($list) {
    return array(58041, 7137, 7138, 7169, 23087, 50267);
}

Example #2

This example will allow different forums access based on the user logged in status.

add_filter('gdpos_allowed_forums_ids_list', 'custom__gdpos_forums_ids_list');
function custom__gdpos_forums_ids_list($list) {
    if (is_user_logged_in() {
      return array(4235, 32457, 22453);
    } else {
      return array(58041, 7137, 7138, 7169, 23087, 50267);
    }
}
0
0
295
Rate this reference

You are not allowed to rate this post.

Comments

Leave a Reply