CM Business Directory Community (CMBDC) - Changing the view with filters (Advanced)

CM Business Directory Community

Back to User Guides

Need a simpler payment solution for charging for Business Listings on your site?

Business Directory Payments might be just what you're looking for.

Disclaimer: This tutorial requires PHP modification skills.

It's possible to change the default ways displayed in the Community form with the " cmbdc_form_data" filter.

This new way allows to group the fields in the sections, decide about their type, labels and whether or not they're mandatory.

	add_filter( 'cmbdc_form_data', array( __CLASS__, 'getBasicFormData' ) );

In the example function below we've added  a section of fields under the  fieldMap key of the array.

The structure required to add the fields is the following multi-level array:

  • top level array key is the label of the Section
  • top level value is the array with the following keys:
    • id - the id of the section (helpful for the styling)
    • fields - the array of arrays each describing one field:
      • field array consists of the following keys:
        • name - name of the data, it will be stored in the meta under this key
        • type - type of the rendered field, possible values are: text, date, textarea, select, confirm, checkbox, taxonomy
        • placeholder - the placeholder value for the input
        • mandatory - the field allowing to decide if it's required field (Y) or not (N)
        • value - the default value of the field
        • options - the array of key - value pairs eg. array( 'apple' => 'Apple') will display the Apple and the inputed value would be 'apple'
        • taxonomy - the slug of the taxonomy to display (only for 'taxonomy' type)
public static function getBasicFormData( $data = array() ) {
         * For testing purposes
        $data[ 'fieldMap' ] = array(
            '1 - User Details'            => array(
                'id'     => 'user_details',
                'fields' => array(
                        'name'        => 'cmbd_username',
                        'type'        => 'text',
                        'placeholder' => 'Username',
                        'mandatory'   => 'Y'
                        'name'        => 'cmbd_email',
                        'type'        => 'text',
                        'placeholder' => 'E-mail',
                        'mandatory'   => 'Y',
                        'value'       => ''
return $data;
    After these fields are added to the form they will overwrite the default business fields.

More information about the  CM Business Directory Community WordPress Plugin

Other WordPress products can be found at  CreativeMinds WordPress Store

Let us know how we can  Improve this Product Documentation Page 

To open a  Support Ticket visit our support center
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.