/**
 * Loads the profile fields.
 *
 * @param $account
 *   An user object.
 * @param $type
 *   The type used - if supported by the module.
 */
function hook_load_profile(&$account, $type = NULL)
{
    $profile = content_profile_load($type, $account->uid);
    if (!$profile) {
        return;
    }
    $fields = content_fields(NULL, $type);
    foreach ($fields as $field_name => $field_attributes) {
        if (isset($profile->{$field_name})) {
            $values = array();
            $contents = $profile->{$field_name};
            foreach ($contents as $content) {
                if (isset($content['value'])) {
                    $values[] = $content['value'];
                } else {
                    $values[] = content_format($field_name, $content);
                }
            }
            if (empty($account->{$field_name})) {
                switch (count($values)) {
                    case 0:
                        $account->{$field_name} = NULL;
                        break;
                    case 1:
                        $account->{$field_name} = $values[0];
                        break;
                    default:
                        $account->{$field_name} = $values;
                }
            }
        }
    }
}
Beispiel #2
0
/**
 * Format a username.
 *
 * @param $object
 *   The user object to format, usually returned from user_load().
 * @return
 *   A string containing an HTML link to the user's page if the passed object
 *   suggests that this is a site user. Otherwise, only the username is returned.
 */
function lullacog_username($object)
{
    if ($object->uid && $object->name) {
        // Shorten the name when it is too long or it will break many tables.
        if (function_exists('content_profile_load') && ($profile = content_profile_load('profile', $object->uid))) {
            if ($profile->title) {
                $object->name = $profile->title;
            }
        }
        if (drupal_strlen($object->name) > 20) {
            $name = drupal_substr($object->name, 0, 15) . '...';
        } else {
            $name = $object->name;
        }
        if (user_access('access user profiles')) {
            $path = $profile ? 'node/' . $profile->nid : 'user/' . $object->uid;
            $output = l($name, $path, array('attributes' => array('title' => t('View user profile.'))));
        } else {
            $output = check_plain($name);
        }
    } else {
        if ($object->name) {
            // Sometimes modules display content composed by people who are
            // not registered members of the site (e.g. mailing list or news
            // aggregator modules). This clause enables modules to display
            // the true author of the content.
            if (!empty($object->homepage)) {
                $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
            } else {
                $output = check_plain($object->name);
            }
            $output .= ' (' . t('not verified') . ')';
        } else {
            $output = check_plain(variable_get('anonymous', t('Anonymous')));
        }
    }
    return $output;
}
Beispiel #3
0
js/script.js"></script>
</head>
<body>
  <div style="width: 98.7%;">
  	<div class="row-fluid data_viz_pad_lr_10 page-header">
  		<div class="span12">
        <h1>Data.gov.in Visualization Engine <small>come, explore, share ... </small></h1>
        <div class="clearfix"></div>
  		</div>
  		<div class="clearfix"></div>
  	</div>
  			  <?php 
if ($viz_path != '') {
    global $user;
    global $base_url;
    $_user_object = content_profile_load('role_request', $user->uid);
    if ($_user_object) {
        if (!empty($_user_object->field_rr_first_name[0][value])) {
            $name = $_user_object->field_rr_first_name[0][value] . ' ' . $_user_object->field_rr_last_name[0][value] . ', ' . $_user_object->field_rr_designation[0][value];
        } else {
            if (function_exists('web_ldap_role_management_get_profile')) {
                $name = web_ldap_role_management_get_profile('profile_first_name') . ' ' . web_ldap_role_management_get_profile('profile_last_name') . ' , ' . web_ldap_role_management_get_profile('profile_designation');
            } else {
                $name = $user->name;
            }
        }
    } else {
        $name = $user->name;
    }
    if ($name != '') {
        ?>
  $count        = $fields['counter']->content;
  $sum          = $view->result[$count]->sss_sum;
  $rate         = $view->result[$count]->sss_sum_dev_count;
  $user_pulse   = $view->result[$count]->sss_sort_vote;
  $count_vote   =  ($rate == 0)?0:$sum/$rate;
  $name         = $fields['field_firstname_value']->content . ' ' . $fields['field_lastname_value']->content;
  $plus       	= round(((143 * $rate / 100) / 14.3), 0);
  $plus_first   = round ($view->result[0]->sss_sort_vote,0) ;
  $plus_last    = round ($view->result[sizeof($view->result)]->sss_sort_vote,0) ;
  $del          = ($plus_first-$plus_last)/8;
  $plus         = round ($view->result[$count]->sss_sort_vote,0);
  $kub          = round($plus/$del+2,0);
  $height_div   = ($kub*14.3);
  $user_info 	  = user_load(arg(1));

  $account_profile = content_profile_load('personal',$user_info->uid);
  if (isset($account_profile->field_first_name[0]['value']) && isset($account_profile->field_last_name[0]['value'])) { $user_info->name = $account_profile->field_first_name[0]['value'].' '.$account_profile->field_last_name[0]['value']; }

 // favorite of users
 $query1 = db_query("SELECT count( node.nid ) AS user_count, node.uid
					FROM node
					INNER JOIN content_field_celebrity AS cfc ON cfc.nid = node.nid
					WHERE cfc.field_celebrity_nid =".$fields['nid']->raw." GROUP BY node.uid");
 $users_favorite = array();

 while( $row = db_fetch_object($query1) ){
	$users_favorite[]=$row->uid;
 }

 $user_count_res = count($users_favorite);
Beispiel #5
0
/**
 * Allows modules to react to the renewal of an expiring role.
 *
 * @param $account
 *   The Drupal user object.
 * @param $rid
 *   The Drupal role ID.
 * @param $timestamp
 *   The UNIX timestamp of the role expiration.
 */
function hook_uc_roles_renew($account, $rid, $timestamp)
{
    // Example: update the expiration date CCK field on a content profile node
    // when an expiring role is renewed
    $node = content_profile_load('profile', $account->uid, '', true);
    if ($node) {
        $node->field_expiration_date['0']['value'] = date('c', $timestamp);
        node_save($node);
    }
}
<?php

$validator_flag = false;
if ($validator_wf = dms_customizations_get_dataset_validator_details($node->nid)) {
    /*$profile_values = dms_customization_profile_values($validator_wf->uid); */
    $user_object = content_profile_load('role_request', $validator_wf->uid);
    $field_ds_ministry_department = '';
    foreach ($user_object->field_ds_ministry_department as $min) {
        $field_ds_ministry_department .= '<div class="field-item even">' . $user_object->taxonomy[$min[value]]->name . '</div>';
    }
    $validator_flag = true;
}
?>
<div id="node-<?php 
print $node->nid;
?>
" class="node<?php 
if ($sticky) {
    print ' sticky';
}
if (!$status) {
    print ' node-unpublished';
}
?>
" >
<?php 
global $base_url;
?>
    
    <?php 
print $picture;
Beispiel #7
0
function fusion_tranquil_username($object)
{
    if ($object->uid && function_exists('content_profile_load')) {
        $profile = content_profile_load('profile', $object->uid);
    }
    if (!empty($profile)) {
        $name = $profile->title;
        if ($name > '') {
            if ($profile->field_profile_private[0]['value'] != 1) {
                //return l($name, 'users/'. $profile->uid . '/profile', array('title' => t('View user profile.')));
                return l($name, 'users/' . $profile->uid . '/profile', array('attributes' => array('title' => t('View user profile.'), 'target' => '_blank')));
                //return l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
            } else {
                return check_plain($name);
            }
        }
    }
    if ($object->uid && $object->name) {
        // Shorten the name when it is too long or it will break many tables.
        if (drupal_strlen($object->name) > 20) {
            $name = drupal_substr($object->name, 0, 15) . '...';
        } else {
            $name = $object->name;
        }
        if (user_access('access user profiles')) {
            $output = l($name, 'user/' . $object->uid, array('attributes' => array('title' => t('View user profile.'))));
        } else {
            $output = check_plain($name);
        }
    } else {
        if ($object->name) {
            // Sometimes modules display content composed by people who are
            // not registered members of the site (e.g. mailing list or news
            // aggregator modules). This clause enables modules to display
            // the true author of the content.
            if (!empty($object->homepage)) {
                $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
            } else {
                $output = check_plain($object->name);
            }
            $output .= ' (' . t('not verified') . ')';
        } else {
            $output = check_plain(variable_get('anonymous', t('Anonymous')));
        }
    }
    return $output;
}
Beispiel #8
0
function afg_activity_title_rewrite($view, $handler, $obj) {
  $title_link = '<div class="views-field-title"><a href= "'. base_path()  .'node/' . $obj->nid . '">'. $obj->node_title . '<a/></div>';

//get user name from profile
  if ($obj->comments_uid) {
    $user_profile = content_profile_load('profile', $obj->comments_uid);
    if ($user_profile->title) {
      $username = $user_profile->title;
    } else {
      $username = user_load($obj-comments_uid)->name;
    }
  }
switch($obj->node_type) {
      case 'group_app_team':
      case 'group_centre_school':
      case 'page':
      if ($obj->comments_uid) {
        $activity_update = $username . ' commented on ' . $title_link;
        } else {
          $activity_update = $title_link;
        if ($obj->node_changed > $obj->node_created) {
            $activity_update .= ' updated.';
        } else {
      $activity_update .= ' created.';
        }
      }
      break;
  
      case 'group_media_image':
      case 'cdi_blog':
      case 'request_for_help':
      case 'blog':
      case 'group_media_video':
      if ($obj->comments_uid) {
          $activity_update = $username . ' commented on ' . $title_link;
      } else {
	      if ($obj->node_og_ancestry_nid){
            $sql='SELECT value FROM {purl} where id=' . $obj->node_og_ancestry_nid;
      } else {
	      if ($obj->og_ancestry_nid){
	        $sql='SELECT value FROM {purl} where id=' . $obj->og_ancestry_nid;
        }
      }
	      $res = db_query($sql);
        $row = db_fetch_array($res);
        $nodepath = base_path() . $row[value];
        $urlslug = '<a href=' . $nodepath . '>';
        $activity_update = $urlslug . $obj->node_og_ancestry_title . '</a>';
        if ($obj->node_changed > $obj->node_created) {
            $activity_update .= ' updated ';
        } else {
            $activity_update .= ' created ';
        }
        $activity_update .= $title_link;
      }
      break;
      default:
        $activity_update = '';
      break;
  }
  return $activity_update;
} 
 *
 * Available variables:
 *   - $user_profile: All user profile data. Ready for print.
 *   - $profile: Keyed array of profile categories and their items or other data
 *     provided by modules.
 *
 * @see user-profile-category.tpl.php
 *   Where the html is handled for the group.
 * @see user-profile-item.tpl.php
 *   Where the html is handled for each item in the group.
 * @see template_preprocess_user_profile()
 */
?>

<?php
	$account_profile = content_profile_load('personal',$account->uid);
	drupal_set_title($account_profile->field_first_name[0]['value'].'_'.$account_profile->field_last_name[0]['value'] )
  ?>

    <div id="contentbox">
        <div id="user-left-container" >
            <h1 class="user-page-name" style="font-size:20px;padding:23px 0 0 15px;"><?php if(isset($account_profile->field_first_name[0]['value']) || isset($account_profile->field_last_name[0]['value'])) { $printed_username = three_beats_substr_name ($account_profile->field_first_name[0]['value'], $account_profile->field_last_name[0]['value'], 18 ) ; } else { $printed_username =  $account->name; }
			print $printed_username;
			?>
			</h1>
            <div class="user-border">
                <div id="user-picture">
					<?php	print theme('imagecache', 'user_avatar', $account->picture ,'user avatar'); ?>
                </div>
                <div>
                    <span class="user-joined"><?php print t('Joined 3beats:') ?><?php print date('M Y',$account->created) ?></span>
Beispiel #10
0
 *
 * Available variables:
 *   - $user_profile: All user profile data. Ready for print.
 *   - $profile: Keyed array of profile categories and their items or other data
 *     provided by modules.
 *
 * @see user-profile-category.tpl.php
 *   Where the html is handled for the group.
 * @see user-profile-item.tpl.php
 *   Where the html is handled for each item in the group.
 * @see template_preprocess_user_profile()
 */
global $user;
drupal_set_title('');
$account = user_load($account->uid);
$content_profile = content_profile_load('profile', $account->uid);
$name = check_plain($account->boincuser_name);
$join_date = date('d F Y', $account->created);
$country = check_plain($content_profile->field_country[0]['value']);
$website = check_plain($content_profile->field_url[0]['value']);
$background = check_markup($content_profile->field_background[0]['value'], $content_profile->format, FALSE);
$opinions = check_markup($content_profile->field_opinions[0]['value'], $content_profile->format, FALSE);
$user_links = array();
$profile_is_approved = ($content_profile->status and !$content_profile->moderate);
$user_is_moderator = user_access('edit any profile content');
$is_own_profile = $user->uid == $account->uid;
if ($user->uid and $user->uid != $account->uid) {
    if (module_exists('private_messages')) {
        // if (function_exists('privatemsg_get_link')) {
        $user_links[] = array('title' => bts('Send message'), 'href' => privatemsg_get_link(array($account)));
    }