Menu

Using WordPress for Client Development Logs

Over at Equal Web Creative I have recently introduced the use of client development logs so that clients can keep a track of the progress on their sites and so that you can communicate more effectively with clients during a project.  In order to implement this I have used WordPress as a multisite installation as well as a few themes and plugins.  Here I intend to explain how I have produced this.

To start with your will need to install a copy of WordPress onto your server and then activate the multisite capabilities of WordPress.  To do this I followed the excellent tutorial below:

Once you have your installation completed you now have the ability to create multiple sites on one WordPress install.  The idea here is that each of your clients will have a 1 site for their client or project log.  You then create users for each of the people within the organisation that will be working on the site so that they can contribute to the discussion and keep track of the progress that is being made.

The next thing is that you will need a theme for the client sites.  I had a brief look around for a theme that was in the style of discussion rather than pure blogging or a website and quickly remembered about Automattic’s P2 theme.  This is a discussion real time blogged theme that is more conducive to a project logs functionality.  The one major alteration to the code that I wanted to make in this theme was to make it so that pages and posts did not appear unless the user was logged in.  To do this I made use of the WordPress is_user_logged_in() function.  The following was added to the site in order to display the content if the user is logged in and to show a login form if the user is not logged in:

[php]
<?php if(is_user_logged_in() ) { ?>
// continue with theme code
<?php } else { >
<?php
// get the login form file
get_template_part( ‘loginform’ );
?>
<?php } ?>
[/php]

The next thing I wanted to do was to make the users login from a standard page that was linked to on the Equal Web Creative site, labelled client login.  Therefore a created a very simple theme on the main network site that consisted on an index.php page in the same design and style as the main Equal Web Creative site that contained a login page.  On submit this redirected the users to the main sites dashboard.  Here is how this was done:

[php]
<form name="loginform" id="loginform" action="<?php echo site_url(‘wp-login.php’, ‘login_post’) ?>" method="post">
<p>
<label><?php _e(‘Username’) ?>
<input type="text" name="log" id="user_login" class="input" value="<?php echo $user_login; ?>" size="15" tabindex="10" /></label>
</p>
<p>
<label><?php _e(‘Password’) ?>
<input type="password" name="pwd" id="user_pass" class="input" value="" size="15" tabindex="20" /></label>
</p>
<?php do_action(‘login_form’); ?>
<input type="submit" name="wp-submit" id="wp-submit" value="<?php _e(‘Log In’); ?>" tabindex="100" />
<input type="hidden" name="redirect_to" value="<?php bloginfo(‘url’); ?>/wp-admin" />
<input type="hidden" name="testcookie" value="1" />
</form>
[/php]

It is the last part of line 12 above that takes the user to the main blogs dashboard.  The problem here was that I wanted them to go to their own project log site rather than this one.  To do this I removed them as a user of the main blog through the Super Admin panel in the WordPress dashboard.  Once this was done it meant they we redirected to the dashboard of their primary site which was their own client or project log.

The final step here was that I wanted them to go straight to the front end of the site and not into the dashboard.  In fact there really is no need for the clients to see the dashboard of WordPress in this setup.  I Googled and searched for this for a long time but eventually settled on this rather botched way of doing it, using a javascript window redirect.  This code is placed in the P2 themes functions.php file in order to redirect none admin users from the dashboard to the live site:

[php]
<?php
// widget dashboard content
function my_wp_dashboard_test() { ?>
<?php if ( current_user_can(‘manage_options’) ) { // checks whether the user is an admin ?>
<p>Welcome to this Equal Web Creative Project Log site. As you are seeing this it means you are a site admin!</p>
<?php } else { ?>
<?php // if the currnet user is not an admin of the site then they are redirected to their primary sites homepage
$user = wp_get_current_user();
$details = get_active_blog_for_user( $user->ID );
$addr = $details->siteurl;
?>
<script type="text/javascript">
<!–
window.location = "<?php echo $addr; ?>"
//–>
</script>
<?php } ?>
<?php } ?>
<?php
// add Dashboard Widget via function wp_add_dashboard_widget()
function my_wp_dashboard_setup() {
wp_add_dashboard_widget( ‘my_wp_dashboard_test’, __( ‘Site Information’ ), ‘my_wp_dashboard_test’ );
}
// use hook, to integrate new widget
add_action(‘wp_dashboard_setup’, ‘my_wp_dashboard_setup’);
?>
[/php]

Basically this code adds a new dashboard widget to the sites dashboard. In that widget it first checks to see if the user is an admin of the site.  If they are it simply outputs a paragraph telling them so.  If they are not an admin it gets their primary sites ID and then redirects them to that site using the javascript window.location function.

And there you have it.  No doubt there are several things within this that could be done better a neater and if you have any feedback on this then please let me know below.  I hope you find it useful.

Leave a Comment

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

Comments

Thanks you this is help me a lot

Why not work with me on your next project?

Get Started