function pcp_block in Profile Complete Percent 6.2
Same name and namespace in other branches
- 5 pcp.module \pcp_block()
- 6 pcp.module \pcp_block()
Implementation of hook_block()
File
- ./
pcp.module, line 38 - Allows users with valid permissions to tag profile fields created from the profile module as required fields for a users profile to be considered complete.
Code
function pcp_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks = array();
$blocks[0]['info'] = t('Profile Complete Percentage');
return $blocks;
break;
case 'view':
$block = array();
switch ($delta) {
case 0:
if (user_is_logged_in()) {
global $user;
$complete_data = pcp_get_complete_percentage_data($user);
$doHide = variable_get('pcp_hide_block_on_complete', 0);
if ($doHide && $complete_data['nextfield'] == '') {
$subject = '';
$content = '';
}
else {
$subject = t('Profile Complete');
$content = theme('pcp_profile_percent_complete', $complete_data);
}
$block['subject'] = $subject;
$block['content'] = $content;
}
break;
}
return $block;
break;
}
}