wpcrm_system_{record type}_fields

The wpcrm_system_{record type}_fields filter returns an array of default fields for the record type specified.

This filter can be used to add new fields or remove default fields that are not needed.

The {record type} that are accepted include:

  • campaign
  • contact
  • opportunity
  • organization
  • project
  • task

The fields are passed as an array to the filter like in this example:

 $contactFields = array(
    array(
      'name'          => 'contact-name-prefix',
      'title'         => WPCRM_NAME_PREFIX,
      'description'   => '',
      'type'          => 'selectnameprefix',
      'scope'         => array( 'wpcrm-contact' ),
      'style'          => 'wp-crm-first',
      'before'          => '',
      'after'          => '',
      'icon'          => 'dashicons dashicons-businessman wpcrm-dashicons',
      'capability'    => WPCRM_USER_ACCESS
    ),
    array(
      'name'          => 'contact-first-name',
      'title'         => WPCRM_FIRST_NAME,
      'description'   => '',
      'placeholder'   => '',
      'type'          => 'default',
      'scope'         => array( 'wpcrm-contact' ),
      'style'          => '',
      'before'          => '',
      'after'          => '',
      'icon'          => '',
      'capability'    => WPCRM_USER_ACCESS
    ),
    array(
      'name'          => 'contact-last-name',
      'title'         => WPCRM_LAST_NAME,
      'description'   => '',
      'placeholder'   => '',
      'type'          => 'default',
      'scope'         => array( 'wpcrm-contact' ),
      'style'         => '',
      'before'          => '',
      'after'          => '',
      'icon'          => '',
      'capability'    => WPCRM_USER_ACCESS
    ),
//and so on
);

You can modify the output of this filter by adding or removing the default fields that are included in the array.

add_filter( 'wpcrm_system_contact_fields', 'remove_contact_name_prefix' );
function remove_contact_name_prefix( $contactFields ){
    //comment out (or delete) the name prefix field and your CRM will no longer show the name prefix field
     $contactFields = array(
        /**array(
          'name'          => 'contact-name-prefix',
          'title'         => WPCRM_NAME_PREFIX,
          'description'   => '',
          'type'          => 'selectnameprefix',
          'scope'         => array( 'wpcrm-contact' ),
          'style'          => 'wp-crm-first',
          'before'          => '',
          'after'          => '',
          'icon'          => 'dashicons dashicons-businessman wpcrm-dashicons',
          'capability'    => WPCRM_USER_ACCESS
        ),*//
        array(
          'name'          => 'contact-first-name',
          'title'         => WPCRM_FIRST_NAME,
          'description'   => '',
          'placeholder'   => '',
          'type'          => 'default',
          'scope'         => array( 'wpcrm-contact' ),
          'style'          => '',
          'before'          => '',
          'after'          => '',
          'icon'          => '',
          'capability'    => WPCRM_USER_ACCESS
        ),
        array(
          'name'          => 'contact-last-name',
          'title'         => WPCRM_LAST_NAME,
          'description'   => '',
          'placeholder'   => '',
          'type'          => 'default',
          'scope'         => array( 'wpcrm-contact' ),
          'style'         => '',
          'before'          => '',
          'after'          => '',
          'icon'          => '',
          'capability'    => WPCRM_USER_ACCESS
        ),
    //and so on (you will need to include the rest of the fields from the array here)
    );
}