WordPress MU Quick Links

Today I made a small module for one of our clients. This module looks something like this:

WordPress MU Quick Links
I added a few IF statements. It will only show the “View Your Blog” and “Manage Your Blog” links if the user has a blog. Additionally, the “Start a Blog” only shows up if the user doesn’t own a blog.

To get a module like this for your site, download mod_php from FWD. Here is the direct download link.

Once you have that installed, just add the following code for that module:

<?php
global $component_name;

if(!defined('WP_JPATH_COMPONENT_SITE'))
        define('WP_JPATH_COMPONENT_SITE', JPATH_ROOT . '/components/com_wpmu' );

if(!defined('ABSPATH'))
        require_once(JPATH_ROOT . '/components/com_wpmu/wp-load.php');

$pb     = 0;
$user   = wp_get_current_user();

if(isset($user->primary_blog))
        $pb = $user->primary_blog;
?>
<div style="text-align: center;background-color: #eff2d3">
    <strong><span style="font-size: 12pt;"><span style="color: #583c23;">Blogs Quick Links:</span></span></strong>
    <br/>
    <?php if($pb){?>
    <a href="<?php echo wp_jroute($link = 'index.php?option='.$component_name.'&blog_id='.$pb); ?>">View Your Blog</a> |
    <a href="<?php echo JRoute::_('index.php?option=com_wpmuadmin'); ?>">Manage Your Blog</a> |
    <?php }else{ ?>
    <a href="<?php echo wp_jroute($link = 'index.php?option='.$component_name.'&task=wp-signup.php'); ?>">Start a Blog</a> |
    <?php } ?>
    <a href="<?php echo JRoute::_('index.php?option=com_content'); ?>">Blog Help</a>
</div>

It’s that simple – now you have a module with tailored links for your users!

Enjoy!

The Core Team
Editorial Staff Members at 'corePHP'
Editorial staff for the Core Technology Blog for 'corePHP' - news, views insights and advice for e-commerce, marketing technology , web design and development.