<?php
/*
Plugin Name: Modify Homepage
Description: Customizes the page users see after logging in to CMS Builder
Version: 1.00
Requires at least: 2.06
*/

// READ BELOW TO CUSTOMIZE THIS PLUGIN

// To disable the home page completely, uncomment this next line and supply a URL to redirect to (e.g. '?menu=_myaccount')
//$GLOBALS['MODIFY_HOMEPAGE_REDIRECT_QUERY'] = '?menu=_myaccount'; // query string to use instead of home page

// To customize the home page's title, modify the HTML between the > < below
function modifyHomepage_title() {
  ?>
Welcome to Township of Wilmot content management system
  
  <?php
}

// To customize the home page's content, modify the HTML between the > < below
function modifyHomepage_content() {
  global $CURRENT_USER;
  ?>
  
    <p><strong>Use these index pages to find links to miscellaneous stand-alone pages, etc:</strong></p>
    <ul>
      <li><strong><a href="../../departments-castle-kilbride-index.php" target="_blank">Castle Kilbride Automatic Index</a></strong> (For reference only; not visible to the public)</li>
      <li><strong><a href="../../departments-castle-kilbride.php" target="_blank">Castle Kilbride</a></strong> (Live) </li>
      <li><strong>CAO Automatic Index</strong> (For reference only; not visible to the public)</li>
      <li><strong>CAO</strong> (Live)  </li>
      <li><strong>Miscellaneous Stand-alone Automatic Index</strong> (For reference only; not visible to the public)
    <?php if ($CURRENT_USER['isAdmin']): ?>
      
    <?php endif ?>
  
  <?php
}

// DON'T UPDATE ANYTHING BELOW THIS LINE

addFilter('admin_postlogin', 'modifyHomepage_redirect');
addFilter('home_title',      '_modifyHomepage_title',   null, 1);
addFilter('home_content',    '_modifyHomepage_content');

function modifyHomepage_redirect() {
  if (!@$GLOBALS['MODIFY_HOMEPAGE_REDIRECT_QUERY']) { return; }
  $menu = @$_REQUEST['menu'];
  if ($menu == 'home' || !$menu) {
    redirectBrowserToURL($GLOBALS['MODIFY_HOMEPAGE_REDIRECT_QUERY']);
    exit;
  }
}

function _modifyHomepage_title($home_title) {
  ob_start();
  modifyHomepage_title();
  return ob_get_clean();
}  

function _modifyHomepage_content($content) {
  ob_start();
  modifyHomepage_content();
  return ob_get_clean();
}  

?>
	
    