function apply_for_role_block_view in Apply for role 7.2
Implements hook_block_view()
Used to render content for creat_block_view
File
- ./
apply_for_role.module, line 243 - Allows users to apply for roles.
Code
function apply_for_role_block_view($delta = '') {
// Check that the relevant block is loaded.
if ($delta == 'apply_for_role') {
// Load user for permissions check.
global $user;
// Check if user can even access apply for role before proceeding.
if (user_access('apply for roles')) {
// Attempt to fetch form.
$form = drupal_get_form("apply_for_role_apply_form", $user);
// Check if form is empty and should not be displayed.
if (!empty($form['no_roles']) && variable_get('apply_for_role_hide_block_no_roles', 0) == TRUE) {
return FALSE;
}
else {
return array(
"subject" => t("APPLY FOR ROLES"),
"content" => $form,
);
}
}
else {
return FALSE;
}
}
}