FOR ARCHIVAL PURPOSES ONLY

The information in this wiki hasn't been maintained for a good while. Some of the projects described have since been deprecated.

In particular, the "Ushahidi Platform v3.x" section contains information that is often misleading. Many details about this version of Platform have changed since.

This website is an extraction of the original Ushahidi wiki into a static form. Because of that, functions like logging in, commenting or searching will not work.

For more documentation, please refer to https://docs.ushahidi.com

Skip to end of metadata
Go to start of metadata

Sometimes you need to add sections to your v2.X site that only administrators can see and use (e.g. pages that modify your ushahidi site, download sensitive data etc). 

Add code to the admin directories

First, your directory structure is slightly different to the one in Adding a new page.  By convention, Ushahidi admin pages are all in the  /admin section of the controllers, views, etc directories.  

Use the Admin view template

Second, you'll probably want to use the admin template so your new section is part of the admin look-and-feel: to make this happen, your controller class should extend Admin_Controller, e.g. for the Reporters admin section, you see this at the top of plugins/reporters/controllers/admin/reporters.php

class Reporters_Controller extends Admin_Controller

Secure your code against non-admin access

You'll want to secure your code against access by anyone who isn't an admin. Which means the usual scruipt at the top of your controller:

<?php defined('SYSPATH') or die('No direct script access.');

And also a piece of code at the top of every function in your controller code that checks that users have the right permissions to be there, e.g. 

// If user doesn't have access, redirect to dashboard
if ( ! $this->auth->has_permission("messages_reporters"))
{
url::redirect('admin/dashboard');
}

(these permissions, e.g. messages_reporters, are different for different user types)

Add your new section to the admin navigation bar

 

  • No labels