Enable Divi Builder on LearnDash Certificates

|

If you try to use the Divi Builder to edit a LearnDash certificate, you may find either that the Divi Builder isn't available, or that you receive the following error: 'Access to certificate page is disallowed'. Either will block you from being able to successfully edit LearnDash certificates in Divi. Here's how to solve these issues.

Enabling Divi Builder on LearnDash Certificate Post Types

By default, the Divi Builder is not enabled for LearnDash Certificates.

If you're using Divi LearnDash Kit, it automatically enables Divi Builder on LearnDash certificates, but if you are not using it, Divi Builder can still be easily enabled on certificates by going to:

Divi > Theme Options > Builder > Post Type Integration > Enable Divi Builder On Post Types

And setting "Certificates" to "Enabled", like so:

Now when you reload the certificate edit screen, you should see the option to use the Divi Builder to edit your certificate, like so:

Fixing the "Access to certificate page is disallowed" Error

At the time of writing, if you try to use the Divi Builder on your certificates you will likely encounter the following error: 'Access to certificate page is disallowed'. This error is due to an incompatibility between the way Divi Builder and LearnDash work, rather than an error in either one of them. This is how the error looks:

You can fix this certificate access error either by installing the Divi LearnDash Kit plugin, or by adding some PHP code. The details of both solutions are given below.

Fixing the Certificate Access Error Using Divi LearnDash Kit

A fix for this issue is included in Divi Learndash Kit. Simply install and activate Divi LearnDash Kit and the fix will automatically be applied. It is available in version 1.2.4 upwards.

Once installed, you should now see the Divi Builder correctly loading on your certificate pages, e.g.:

Fixing the Certificate Access Error Using PHP

If you're comfortable adding PHP to your site, here's the same code used by Divi LearnDash Kit to fix the issue. Simply add it, for example, into the functions.php file of your child theme and it should take effect when you next load the certificate edit page.

// === Start: Fix Learndash "Access to certificate page is disallowed." error in Divi Builder ===
// https://divibooster.com/fixing-the-learndash-access-to-certificate-page-is-disallowed-error/

add_action('template_redirect', 'dbc_allowCertificateEditingInVb', 4);

if (!function_exists('dbc_allowCertificateEditingInVb')) {
    function dbc_allowCertificateEditingInVb() {
        $builderPage = isset($_GET['et_bfb']) || isset($_GET['et_fb']);
        $userCanEdit = (is_user_logged_in() && function_exists('et_pb_is_allowed') && et_pb_is_allowed('edit_posts'));
        if ($builderPage && $userCanEdit) {
            // LD pre-3.2.3
            if (class_exists('SFWD_CPT_Instance') && isset(SFWD_CPT_Instance::$instances['sfwd-quiz'])) { // Quiz CPT instance is doing the certificate access check
                remove_action('template_redirect', array(SFWD_CPT_Instance::$instances['sfwd-quiz'], 'template_redirect_access'));
            }
            // LD 3.2.3 and up
            remove_action('template_redirect', 'learndash_certificate_display', 5);
        }
    }
}
// === END ===

This post may contain referral links which may earn a commission for this site

Divi Booster

Hundreds of new features for Divi
in one easy-to-use plugin

8 Comments

  1. Hi – I'm using the latest version of Divi Learndash Kit and Divi Theme and the Certificate builder doesn't work at all. Just doesn't load the builder so you can't design a certificate. Any help on this?

    Reply
    • Hey Pippen, the fix currently applies to the back-end version of the visual Builder only, so if you're trying to use the front-end visual builder that might be the issue. The next update (v1.3.4) will extend the fix to apply to the front-end as well. In the meantime, if you switch to editing the certificate in the back-end (i.e. within the WordPress admin area), that should hopefully work for you – it does on my test site, at least. If that / the update don't help, would you be able to send through a login (via the contact form) so that I can take a look for you? Cheers!

      Reply
      • Thank you! I am editing through the WordPress admin area so will get back to you if the v1.3.4 update doesn't work. Just use this same form, if needed? Thanks!

        Reply
        • Sure thing, Pippen, I'll wait to hear. The contact form is the best place if your sending through login details, etc, but feel free to just reply here if it suits you better – I'll remove anything sensitive from the comment before publishing.

          Reply
  2. Wen trying to fix with the php function : "Cannot redeclare dbldk_allowCertificateEditingInBfb() (previously declared in wp-content/plugins/divi-learndash-kit/features/fix-bfb-certificate-access/fix-bfb-certificate-access.php:7)
    "

    Reply
    • This will have occurred because the same code was being applied both manually (using the PHP fix) and by Divi LearnDash Kit, causing the function to be redeclared. I've added a check to the code so the error shouldn't happen in the future. Note that this means the plugin's version of the code will be the one that runs, if present. Thanks!

      Reply
  3. I am sorry but the Divi LearnDash Kit 1.2.6 doesn't fix this error for me.. I don't know what I am doing wrong.

    Reply
    • Hi Delphine, it looks like the recent LearnDash update made some changes which stopped the fix from working. I've just updated the post above with a revised fix that should work with both the current and older LearnDash versions. This will be in the next update of Divi LearnDash Kit (v1.2.8). I hope it helps!

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.