Open file Service/Callback.php add following function:

public function getGlobalPrivacySettings()
        return array(
            'todo.default_privacy_setting' => array(
                'phrase' => _p('todo')

Edit file add.html.php, add following code

{if Phpfox::isModule('privacy')}
     <div class="table form-group-flow">
            <div class="table_left">
                {_p var='privacy'}:
            <div class="table_right">
                {module name='privacy.form' privacy_name='privacy' privacy_info='control_who_can_see_this_todo' default_privacy='todo.default_privacy_setting'}


Back to file Controller/AddController.php, modify it as following code

$iItemId  = \Phpfox::getLib('database')->insert(\Phpfox::getT('todolist_task'),[
    'user_id'=> \Phpfox::getUserId(), // get current user id
    'name'=> $vals['name'],
    'time_stamp'=>time(),  // creatation time
    'time_update'=>time(), // last modification time
    'privacy'=>$vals['privacy'], // modify this line...
    'task_status'=>0, // mark task is in-complete
//...and this condition statement
if ($vals['privacy'] == '4') {
    \Phpfox::getService('privacy.process')->add('todo', $iItemId,
        (isset($aVals['privacy_list']) ? $aVals['privacy_list'] : array()));

Now your todo list item has it own privacy. We open Controller/ViewController.php to check if user has the permission to view it.

We add following code, right after getting todo-list detail:

$aItem  = $browseService->getForBrowse($id);
if (\Phpfox::isModule('privacy')) {
    \Phpfox::getService('privacy')->check('todo', $aItem['task_id'], $aItem['user_id'], $aItem['privacy'],


We have following value for privacy:


We have to modify function getForBrowse to get more information if missing.

Next Chapter