Documentation / Dependencies / Advanced Custom Fields

Duzz Sync with ACF

While the Duzz Custom Portal works without Advanced Custom Fields, you won’t get all of the features without it. That includes the progress bar, project stages, auto project updates, approval status and most Duzz Bot updates. Wow those are a lot of features you are missing out on with ACF. The good news is that you can use the free version of ACF from the WordPress repository. But you can search for it in your Plugins section of WordPress too. Plugin repository

Here are the steps to integrate.

  1. You can have the ACF installed before or after Duzz is installed. Go to ‘Install Plugins’ within the Duzz Portal WordPress Admin settings and click ‘Install’ under ‘Advanced Custom Fields’ and then click ‘Activate’
  2. Install plugins
  3. Once they are both installed, go to the Duzz Portal settings and go to ACF Keys.
  4. Duzz Portal settings ACF Keys
  5. You’ll notice it says ‘Error: Duplicate field number found.’ Below all the fields. This is because all the fields are installed as empty, so it would give a duplication error.
  6. Now scroll to the bottom and look for ‘Generate ACF Keys’ and click ‘Generate’ which will generate random unique ACF keys for each field.
  7. Duzz settings ACF keys generator
  8. Now go to the very bottom and click ‘Save’ and this will save all your keys to ACF.
  9. Now go to your ACF plugin and you’ll notice it created the ‘Duzz Fields’ group with all your saved keys.
  10. If you want to change any fields from the ones added automatically by Duzz to ACF, in ACF you’ll have to get the ACF ‘Field Keys’. Go to ACF and click on the field group where you are adding a field, click Screen Options at the top and then check ‘Field Keys’. Now it will display a new column with all the keys. This is how you link ACF fields to Duzz fields. Then copy those keys and go to the Duzz settings ‘ACF Keys’ tab and paste that key into any field. Currently you can’t add new fields in Duzz here so pick one you aren’t using if you need to, or contact us for an update.
  11. ACF keys
  12. There are two ACF fields that Duzz is dependent on. The progress bar operates using the ‘project_status’ field and then ‘approved_status’. These features do not work without ACF but Duzz will continue to function otherwise and you won’t notice these features are missing either. More info here.
  13. approval status
  14. Do make ‘approved_status’ work, go back to ACF fields list in the My Group list. First, look for the field name ‘approved_status’. Click to edit ‘approved_status’ and then switch the field type to ‘Select’ and copy these four selections below:
    Text
    
    Under Review
    Yes
    No
    Closed - Lost
    Closed - Won
    
    And add paste these into Choices.
  15. Then to make the progress bar work, find the field name ‘project_status’ and click edit. You will also switch this field type to ‘Select’. This field controls your progress bar on customer project pages. If this is not updated, the progress bar will show an error. Unlike ‘approved_status’ though, you can customize ‘project_status’ a little more. You’ll be adding the steps in your process here. But you can add as many steps as you want. You should have 2 at the minimum. You can name your steps however you like. But it needs to be formatted like this: (number)(colon)(space)(name) so that it looks like this:
    Text
    
    1: Welcome
    2: Consultation
    3: Working
    4: Done
    5: Payment
    6: Completed
    
    Copy and paste this into Choices if you want for guidance.
  16. Now on the main Duzz settings page, in the section Acf Group, this is optional you can leave it as is if you don’t want to use. But if you want the bot to update the status feed when you update fields, you’ll need to get the ACF group name. If you go to ACF and hover over the group name, at the bottom of your browser, you’ll see a URL popup in tiny text. Inside it will say post= and whatever that number is, is the group number. Add this group number to the ACF Group ID 1 field in Duzz Settings.
  17. ACF group and remove keys
  18. If there is a field you do not want added by the bot by the status feed, create a new ACF group and move a field to it and don’t include that group number in the Duzz settings Acf Group. As you begin to use Duzz you’ll probably see Bot messages you don’t want added, you can do it like that. Step 21 shows an alternative.
  19. So alternatively, in the Remove Keys section in the Duzz Portal settings, you can add field keys from ACF that you do not want added by the Bot to the Duzz feed. This is easier if you only have a few fields you don’t want the Bot to update. For more info check out these instructions.

Filter: Adding Custom Fields

This is only for Advanced WordPress users with knowledge of PHP as this could break your site. Duzz by default only has a limited number of Advanced Custom Fields connections. If you’d like to connect more Advanced Custom Fields to the Duzz plugin, you can easily do so by hooking into our filter modify_duzz_field_data. This filter allows you to append or modify the default set of fields returned by the plugin.

Step-by-step Guide:

  1. Firstly, ensure you’ve properly set up your development environment, and you’re familiar with WordPress’s hook system.
  2. Use the add_filter function provided by WordPress to hook into our filter. This function allows you to append or modify fields in the Duzz plugin.
  3. Return the modified array of fields from your callback function.

Code Example:

PHP

function add_custom_fields_to_duzz($default_fields) {
    // Define your custom fields as an associative array.
    $custom_fields = array(
        'email' => 'field_64f88ef6596ee',
        'website' => 'field_64f88edf497ad',
        'name' => 'field_64f88ef066cc8'
        //... Add more fields as required
    );

    // Combine the default fields with your custom fields.
    return array_merge($default_fields, $custom_fields);
}

// Hook into the 'modify_duzz_field_data' filter.
add_filter('modify_duzz_field_data', 'add_custom_fields_to_duzz');

Replace the sample field names and IDs in the example with your desired field names and IDs.

Once hooked, your custom fields will now be merged with the default fields in the Duzz plugin. You can also modify or remove existing fields if necessary.

Note: Always test your changes in a staging environment before applying them to a live site to ensure compatibility and desired outcomes.