Adaptable theme for Moodle 3.6?

Re: Adaptable theme for Moodle 3.6?

by Niall Sheehan -
Number of replies: 1

I have also done a clean install, everything is working as expected with Clean and More, no love for Adaptable. The dashboard is still showing all areas as expanded (see image in last post) and the message drawer doesn't work at all.

We REALLY like the Adaptable Theme, tried a couple others, none offer the adaptability of Adaptable. Adaptable is the most popular of the themes so I'm very hopeful that this will get sorted out. 

If there is anything I can do to assist, LMK.


When adding a Contact (using the Clean Theme) We get the error below.

Attachment add-contact-error-clean.JPG
In reply to Niall Sheehan

Odp: Re: Adaptable theme for Moodle 3.6?

by Wiktor Wandachowicz -
Picture of Core developers

I believe this message comes from the following code (the first if block).
It looks like the call to can_create_contact() fails for some reason. Maybe your user or role has no capability of some sort?

File: message/externallib.php

if (!\core_message\api::can_create_contact($params['userid'], $params['requesteduserid'])) {
    $result['warnings'][] = [
        'item' => 'user',
        'itemid' => $params['requesteduserid'],
        'warningcode' => 'cannotcreatecontactrequest',
        'message' => 'You are unable to create a contact request for this user'
    ];
} else {
    if ($requests = \core_message\api::get_contact_requests_between_users($params['userid'], $params['requesteduserid'])) {
        // There should only ever be one but just in case there are multiple then we can return the first.
        $result['request'] = array_shift($requests);
    } else {
        $result['request'] = \core_message\api::create_contact_request($params['userid'], $params['requesteduserid']);
    }
}

Edit:

And indeed it very much may be a problem with configuration. Could you please check if you have messaging enabled? And if both users are sharing the same course?

File: message/classes/api.php

/**
 * Checks if a user can create a contact request.
 *
 * @param int $userid The id of the user who is creating the contact request
 * @param int $requesteduserid The id of the user being requested
 * @return bool
 */
public static function can_create_contact(int $userid, int $requesteduserid) : bool {
    global $CFG;

    // If we can't message at all, then we can't create a contact.
    if (empty($CFG->messaging)) {
        return false;
    }

    // If we can message anyone on the site then we can create a contact.
    if ($CFG->messagingallusers) {
        return true;
    }

    // We need to check if they are in the same course.
    return enrol_sharing_course($userid, $requesteduserid);
}