Skip to content
View as Markdown

Company Profile Section

FluentCRM Core Intermediate

You can add custom tabs to the FluentCRM company profile page using the Extender API. This works the same way as contact profile sections, but for company profiles.

Basic Example

php
add_action('fluent_crm/after_init', function () {
    FluentCrmApi('extender')->addCompanyProfileSection(
        'my_company_section',
        __('My Custom Section', 'your-plugin'),
        function ($contentArr, $company) {
            $contentArr['heading'] = 'Company Details';
            $contentArr['content_html'] = '<div>
                <p>Company: ' . esc_html($company->name) . '</p>
                <p>Industry: ' . esc_html($company->industry) . '</p>
            </div>';
            return $contentArr;
        }
    );
});

API Reference

FluentCrmApi('extender')->addCompanyProfileSection($key, $sectionTitle, $callback, $saveCallback)

ParameterTypeRequiredDescription
$keyStringYesUnique section identifier. Use your plugin prefix to avoid conflicts.
$sectionTitleStringYesTab title displayed in the company profile sidebar
$callbackCallableYesRenders the section content
$saveCallbackCallableNoHandles save requests from the section

Render Callback

ParameterTypeDescription
$contentArrArrayContains heading and content_html keys to populate
$companyCompanyThe company model with all properties

The $contentArr you return must include:

  • heading — Section heading displayed at the top
  • content_html — HTML content rendered in the section body

Save Callback (Optional)

ParameterTypeDescription
$responseArrayResponse array to return
$dataArrayPosted form data
$companyCompanyThe company model
php
FluentCrmApi('extender')->addCompanyProfileSection(
    'my_company_section',
    __('Company Notes', 'your-plugin'),
    function ($contentArr, $company) {
        $notes = get_option('my_plugin_company_notes_' . $company->id, '');
        $contentArr['heading'] = 'Internal Notes';
        $contentArr['content_html'] = '<textarea name="notes">' . esc_textarea($notes) . '</textarea>';
        return $contentArr;
    },
    function ($response, $data, $company) {
        if (isset($data['notes'])) {
            update_option('my_plugin_company_notes_' . $company->id, sanitize_textarea_field($data['notes']));
        }
        $response['message'] = __('Notes saved', 'your-plugin');
        return $response;
    }
);

Available Company Properties

The $company model provides access to:

  • $company->name — Company name
  • $company->industry — Industry
  • $company->email — Company email
  • $company->phone — Phone number
  • $company->address_line_1, $company->city, $company->state, $company->postal_code, $company->country — Address fields
  • $company->website — Website URL
  • $company->description — Company description
  • $company->type — Company type
  • $company->owner_user_id — WordPress user ID of the company owner

Custom Company Profile Section

Source: app/Api/Classes/Extender.php