Example #1
0
/**
 * Get settings fields by section.
 *
 * @since 2.1.0 bbPress (r4001)
 *
 * @param string $section_id
 * @return mixed False if section is invalid, array of fields otherwise.
 */
function bbp_admin_get_settings_fields_for_section($section_id = '')
{
    // Bail if section is empty
    if (empty($section_id)) {
        return false;
    }
    $fields = bbp_admin_get_settings_fields();
    $retval = isset($fields[$section_id]) ? $fields[$section_id] : false;
    return (array) apply_filters('bbp_admin_get_settings_fields_for_section', $retval, $section_id);
}
 public static function log_override(array $data)
 {
     if ('settings' === $data['connector'] && 'bbpress' === $data['args']['context']) {
         $settings = bbp_admin_get_settings_fields();
         /* fix for missing title for this single field */
         $settings['bbp_settings_features']['_bbp_allow_threaded_replies']['title'] = __('Reply Threading', 'bbpress');
         $option = $data['args']['option'];
         foreach ($settings as $section => $fields) {
             if (isset($fields[$option])) {
                 $field = $fields[$option];
                 break;
             }
         }
         if (!isset($field)) {
             return $data;
         }
         $data['args']['label'] = $field['title'];
         $data['connector'] = self::$name;
         $data['context'] = 'settings';
         $data['action'] = 'updated';
     } elseif ('posts' === $data['connector'] && in_array($data['context'], array('forum', 'topic', 'reply'))) {
         if ('reply' === $data['context']) {
             if ('updated' === $data['action']) {
                 $data['message'] = __('Replied on "%1$s"', 'stream');
                 $data['args']['post_title'] = get_post(wp_get_post_parent_id($data['object_id']))->post_title;
             }
             $data['args']['post_title'] = sprintf(__('Reply to: %s', 'stream'), get_post(wp_get_post_parent_id($data['object_id']))->post_title);
         }
         $data['connector'] = self::$name;
     } elseif ('taxonomies' === $data['connector'] && in_array($data['context'], array('topic-tag'))) {
         $data['connector'] = self::$name;
     }
     return $data;
 }