<?php
/*
Plugin Name: Modify Homepage
Description: Customizes the page users see after logging in to CMS Builder
Version: 1.01
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() {
  ?>
  
    Elle Schorr's Shortcuts
  
  <?php
}

// To customize the home page's content, modify the HTML between the > < below
function modifyHomepage_content() {
  global $CURRENT_USER;
  ?>

    </p>
    <p>Select an option from the menu on the left, or one of these common actions:</p>
    <ul>
      
      <li><a href="?menu=art&action=add">Add an image to Gallery 1</a></li>
       <li><a href="?menu=nature&action=add">Add an image to Gallery 2</a></li>
        <li><a href="?menu=people&action=add">Add an image to Gallery 3</a></li>
         <li><a href="?menu=places&action=add">Add an image to Gallery 4</a></li>
          <li><a href="?menu=reflections&action=add">Add an image to Gallery 5</a></li>
      <li><a href="?menu=projects&action=add">Add a Project</a></li>
      <li><a href="?menu=exhibitions&action=add">Add an Exhibition</a></li>
      <li><a href="?menu=publcity_listings&action=add">Add a Publicity Listing</a></li>
     <br />
      <li><a href="http://pixlr.com/express/" target="_blank">Quickly crop or edit an image using the free Pixlr Express image editor</a></li>
    </ul>
    <?php if ($CURRENT_USER['isAdmin']): ?>
      <p><b>Administrators:</b> Use the <a href="?menu=database">Section Editors</a> to add sections and generate PHP viewers.</p>
    <?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();
}  

?>
