Support

Account

Home Forums ACF PRO user fields on bbpress edit profile page

Helping

user fields on bbpress edit profile page

  • Hi

    I have added some user fields to the user edit form and they are showing on the bbpress edit user profile page on the frontend.

    1. How can I move the position of the acf fields? I have tried to change the Order No. but it has no effect.

    2. How can I remove the acf user fields from the bbpress edit user profile page on the frontend?

    Thanks

  • 1. there isn’t any way to alter the field group order on the user profile page. If you have more than one field group on the profile page you can order them but they will all appear below the standard user profile fields.

    2. I did some testing. It appears that bbpress uses the standard user profile form and there’s no real way for ACF to know the difference. I’m also assuming you mean the edit profile page that appears on the front end of the site. What you need to do is add a new location rule to stop the displaying of a field group on the front end of the site. Add this code to your functions.php file

    
      
      add_action('acf/location/rule_types', 'acf_add_special_rule_type');
      function acf_add_special_rule_type($choices) {
        if (!isset($choices['Special'])) {
          $choices['Special'] = array();
        }
        if (!isset($choices['Special']['is_admin'])) {
          $choices['Special']['is_admin'] = 'is_admin';
        }
        return $choices;
      }
      add_filter('acf/location/rule_values/is_admin', 'acf_location_rules_values_special_is_admin');
      function acf_location_rules_values_special_is_admin($choices) {
        $choices['true'] = 'true';
        $choices['false'] = 'false';
        return $choices;
      }
      add_filter('acf/location/rule_match/is_admin', 'acf_location_rules_match_is_admin', 10, 3);
      function acf_location_rules_match_is_admin($match, $rule, $options) {
        if ($rule['param'] != 'is_admin') {
          return $match;
        }
        if ($rule['operator'] == '==') {
          $match = is_admin();
        } elseif ($rule['operator'] == '!=') {
          $match = !is_admin();
        }
        if ($rule['value'] != 'true') {
          $match = !$match;
        }
        return $match;
      }
      
    

    I’ve added this to my filters repo so this is a shameless plug to get a link https://github.com/Hube2/acf-filters-and-functions/blob/master/is_admin-acf-location-rule.php

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘user fields on bbpress edit profile page’ is closed to new replies.