applicable_formats for only the user 'My home'

245 views Asked by At

What needs to be in the array in the applicable_formats() function so it only is available on the My home page of the user? I've set my-index to true.

acces.php

<?php
$capabilities = array(

'block/groups:myaddinstance' => array(
    'captype' => 'write',
    'contextlevel' => CONTEXT_SYSTEM,
    'archetypes' => array(
        'user' => CAP_ALLOW
    ),

    'clonepermissionsfrom' => 'moodle/my:manageblocks'
),

'block/groups:addinstance' => array(
    'riskbitmask' => RISK_SPAM | RISK_XSS,

    'captype' => 'write',
    'contextlevel' => CONTEXT_BLOCK,
    'archetypes' => array(
        'editingteacher' => CAP_ALLOW,
        'manager' => CAP_ALLOW
    ),

    'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
);

I've copied access.php from the blocks tutorial and only changed the names

1

There are 1 answers

6
Russell England On BEST ANSWER

UPDATE - it should be just 'my' rather than 'my-index'.

Also just for completeness, you might want to add all = false

public function applicable_formats() {
    return array('all' => false, my' => true);
}