certificate_test.module in Certificate 8.3
File
modules/certificate_test/certificate_test.module
View source
<?php
function certificate_test_certificate_map_options() {
$chars = drupal_map_assoc(array_merge(range('a', 'z')));
return array(
'firstletter' => array(
'title' => 'Username first letter',
'description' => "Map by the first letter of the user's name",
'options' => $chars,
),
);
}
function certificate_test_certificate_map($node, $user, $map_type, $options) {
if ($map_type == 'firstletter') {
foreach ($options as $option) {
if (strtolower($user->name[0]) == $option) {
return $option;
}
}
}
}
function certificate_test_access_certificate($node, $user) {
if ($node->type == 'certificate_activity') {
if (isset($GLOBALS['certificate_ok']) || isset($_GET['certificate_ok'])) {
return TRUE;
}
else {
return 'Custom access denied message.';
}
}
}