Display Personalized Messages to Multisite Users with the Custom Dashboard Widget

As your WordPress Multisite network grows, you need the ability to send important announcements like network outages, support updates, popular posts, or just a quick hello to let them know you’re thinking about their site.

But you have to send that message without being too intrusive or you risk annoying your loyal followers.

There’s no guarantee an email message will be read, or that your admins will even stay subscribed to your newsletter after site sign up. If your network is large, making phone calls is out of the question. You can’t rely on RSS feeds either – plus who wants to waste a blog post with a status update?

Now, with the Custom Dashboard Widget Plugin, you can display a message where all your site admins are guaranteed to see it – in their own site dashboards. The plugin is easy to use, and has just 4 settings:

1. Allow site admins to customize for their blog

Most individual dashboard widgets do not allow any customization, which means the only thing you can do is turn them on or off using the “Screen Options” drop down selector. This helps you organize your main dashboard area with the items you and your admins reference most often.

Placing a check in the box enables individual dashboard widgets available for your site, and displays that widget on your dashboard. Some plugins add additional widgets to your dashboard as well.

For instance, the MarketPress e-commerce plugin adds a Store Statistics Widget which shows recent products sold through your store.

The Custom Dashboard Widget Plugin goes a step further and allows your site admins to customize what is displayed inside your custom widget.

Site admins can customize the dashboard widget to fit their site

This option can be turned on with the first setting in the Custom Dashboard Widget Settings Area, which is a simple yes/no selector.

The default position is “No” which means site admins will not be able to customize the dashboard widget – only turn its display on or off with screen options.

Turning the Option to “Yes” will add a “configure” link inside the dashboard widget and allow each individual site admin on your network to edit the custom dashboard widget text and code to make a unique display on their own dashboards.

One negative note here is that the Custom Dashboard Widget can accept code for evaluation, and if the site admin chooses to edit that code, but doesn’t know what he or she is doing, it could cause error messages to display inside that users Dashboard.

2. Title

The title setting is a simple text box in which you can enter the desired title of your custom dashboard widget. You’ll notice the title shows up in the shaded gradient area above the actual widget content.

Edit the Widget Title to Display Your Custom Announcements

 

When users minimize the dashboard widget, the title is the only part of the widget that remains visible. Make sure to choose a title that aptly describes the content being placed in it. You could use the name of your main blog, and RSS feed, or any other status announcement you choose.

 

3. Content

The content of your message is added through the content box in the plugin settings, which can be expanded to fit as much content and text as necessary. Adding content to the Custom Dashboard can be done in several ways:

  • Text
  • HTML
  • PHP

Adding Plain Text to the Custom Dashboard Content Box

Text is easy to add and requires no special coding be used. Simply enter any text you want to display in the box. The text you enter here will display exactly the same way on the custom widget in the site admin’s dashboard.

 

Adding HTML to the Custom Dashboard Content Box

The content area of the Custom Dashboard Widget Plugin settings also accepts html code. For instance, if you wanted to insert a link back to the main blog on the network you could add an A tag like:

1
Remember, for questions or comments regarding your site, please visit the <a href="http://www.orgspring.org/clients/knowledgebase.php">OrgSpring Wiki Page</a> or log a support ticket using the 'Support' button in the menu bar directly to the left.

That creates a custom dashboard widget that looks something like this:

Custom Dashboard Widget Allows HTML Links in Messages

 

Adding PHP Code to the Custom Dashboard Content Box

The content box has the ability to evaluate php code, which means you can assign and call variables, pull up WordPress template tags, and do just about everything you can do with PHP.

This makes the custom dashboard widget very powerful. It gives you, the network admin, the ability to personalize each dashboard widget to the individual site admin with just a few lines of code.

For example, using the code below, we can display a custom intro message, the current date, several items in a feed from the main network blog, and a message reminding the site admin where to go for help and support.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
?>
<strong><span style="font-size: medium"><!--?echo “Welcome to the OrgSpring Nonprofit Network of Sites!” ;?></span></strong>

Today is <? echo date(“F j, Y”);?>

Here are the latest articles from the OrgSpring Blog:
<?
$feed = file_get_contents(‘http://www.orgspring.org/feed’);
$rss = new SimpleXmlElement($feed);
echo<ul>
<ul>”;</ul>
</ul>
&nbsp;
<ul>
<ul>foreach($rss->channel->item as $entry) {</ul>
</ul>
&nbsp;
<ul>
<ul>if ( $tempCounter < 3 )</ul>
</ul>
&nbsp;
<ul>
<ul>{</ul>
</ul>
&nbsp;
<ul>
<ul>echo</ul>
</ul>
<a>link' title='$entry->title'>” . $entry->title . “</a>

&nbsp;
<ul>‘$entry->description’</ul>
”;
$tempCounter += 1;
}
echo “

”;
}
?>
<strong>Remember, for questions or comments regarding your site, please the <a href="http://orgspring.org/wiki" target="_blank">OrgSpring Wiki Page</a> or log a support ticket using the ‘Support’ button in the menu bar directly to the left.</strong>

That code renders a custom dashboard widget that looks like the image below.

 

Of course, you’d change ‘http://www.orgspring.org/feed’ to use your own site feed URL. You could display any valid feed url, not just your own main network site. For instance, a multisite network about technology could include Tech Crunch’s feed. Feeds with images will show up too and can really make your user’s dashboards unique.

 

A Word of Caution When Using PHP in the Content Box

The content box uses a php function called eval(), which tells WordPress to evaluate whatever is in the content box as php code.

The eval () function requires the code it is evaluating to be formatted a certain way. In particular, it requires no leading or trailing php tags ‘<’ which means code in the content box has to be passed without them.

Not formatting the php content correctly will result in a parse error and the dashboard widget content will not display. For more on this issue, you can read a forum post on WPMUDEV, which discusses how to correctly format the content box PHP and remove parse errors.

Just Want a Custom Feed? Try a Plugin.

If all you want to display in the custom dashboard widget is a feed of your own main blog posts, you can use the Multisite Dashboard Feed Widget, instead of using executable code. It doesn’t give you the ability to tailor your intro message, but it styles the feed nicely and looks great in a widget.

4. Execute Content

If you do plan to include php code inside the content box, you’ll want to make sure the check box for the last setting is selected – the Execute Content setting. This check box triggers the eval() tag and renders the code inside the actual dashboard widget.

With this setting turned off, the plugin will not parse your php code, and using the example above, you’ll get an incomplete dashboard widget that looks something like this:

Don't forget to check the Execute Content Box for PHP Content

 

Summary

The Custom Dashboard Widget is a great way to send custom, personalized messages to your site admins on a multisite network WordPress installation. With just 4 easy settings, you can make your user’s experience much better, while also marketing your products and services directly to your users in the one place they all visit – their own blog dashboard.

If you want to get even more creative with the messages you deliver to your network site admins, try combining the Custom Dashboard Widget with these other plugins:

Dashboard Feeds – Replace standard dashboard feeds with custom feeds.

Dashboard Widget Order – Change the order of your Dashboard widget displays.

BuddyPress Hide Widgets - If you’re running BuddyPress, this plugin will help you easily hide certain widgets.

Comments (1)

Participate