Skip to content

Instantly share code, notes, and snippets.

@juanramon
Created November 29, 2012 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanramon/4169766 to your computer and use it in GitHub Desktop.
Save juanramon/4169766 to your computer and use it in GitHub Desktop.
Redirect from dashboard to listing items
<?php if ( !defined('ABS_PATH') ) exit('ABS_PATH is not loaded. Direct access is not allowed.');
class ThemeBackofficeRedirect
{
var $location;
var $section;
public function __construct()
{
$this->location = Rewrite::newInstance()->get_location();
$this->section = Rewrite::newInstance()->get_section();
osc_add_hook('init', array(&$this, 'redirect_user_backoffice'), 2);
}
function redirect_user_backoffice()
{
if( ($this->location === 'user') && ($this->section === 'dashboard') ) {
$this->redirect( osc_user_list_items_url() );
}
}
private function redirect($url)
{
header('Location: ' . $url);
exit;
}
}
// End of file: ./theme/class/ThemeBackofficeRedirect.class.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment