We launched the multi-tenant WordPress Marketplace! 🎉

Communicate WPCS DNS data to your customers

sybren@wpcs.io

When your customers want to use a custom domain and they manage its DNS themselves, you’ll have to communicate WPCS’ DNS data somehow. One way of achieving this could be by sending them an e-mail from your own CRM. Another way, however, is to simply display the data in the tenant’s Dashboard! Here’s a quick and dirty way of getting WPCS DNS data to your customers.

Requirements

To create a Dashboard widget, we’ll use the Code Snippets plugin.

Display the DNS requirements

Let’s get straight to it and create a dashboard widget with the DNS data hardcoded. Add the following code as a PHP snippet:

<?php

add_action('wp_dashboard_setup', 'register_wpcs_dns_data_widget');
  
function register_wpcs_dns_data_widget() {
    global $wp_meta_boxes;

    // Add the widget, the second argument is the title of the widget
    wp_add_dashboard_widget('wpcs_dns_data_widget', 'Configure your domain', 'display_wpcs_dns_data');
}

function display_wpcs_dns_data() {
    echo "<p>Welcome!</p>";
    echo "<p>In order to use your own domain name for this website, configure your DNS in the following way:</p>";

    echo "<h3>For root domains:</h3>";
    echo "<p>Add <i>all</i> the following A records for your domain and remove any existing A records:</p>";
    echo "<div><input readonly style=\"margin-bottom:5px\" value=\"1.1.1.1\" /></div>";
    echo "<div><input readonly style=\"margin-bottom:5px\" value=\"1.1.1.1\" /></div>";
    echo "<div><input readonly value=\"1.1.1.1\" /></div>";
    echo "<br />";

    echo "<h3>For subdomains:</h3>";
    echo "<p>Add a CNAME record with the following value:</p>";
    echo "<div><input readonly value=\"public.example.wpcs.io\" /></div>";
}

CAUTION

The DNS values for custom domains are region-specific. Check the WPCS Console to see what the actual IP addresses and CNAME values should be for the region your product resides in. You can find this information on the tenant details screen.

NOTE

Don’t forget to enable the snippet and set it to Only run in administration area!

Build a low code SaaS today

Start a 30-day free trial – Cancel anytime

Plugin name

Author

Code Snippets Pro

Description

When your customers want to use a custom domain and they manage its DNS themselves, you’ll have to communicate WPCS’ DNS data somehow. One way of achieving this could be by sending them an E-mail from your own CRM. Another way, however, is to simply display the data in the tenant’s Dashboard! Here’s a quick and dirty way of getting WPCS DNS data to your customers.

Code Snippet