CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • What is the CiviCRM file to edit the /user/<username> page in Drupal My Account?
Pages: [1]

Author Topic: What is the CiviCRM file to edit the /user/<username> page in Drupal My Account?  (Read 827 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
What is the CiviCRM file to edit the /user/<username> page in Drupal My Account?
August 28, 2010, 03:53:39 pm
I wish to put:

» View Contact Record
» View Contact Dashboard


Above the CiviCRM profiles displayed, not below.  

Drupal path:  http://mysite.org/users/<username>  (the "my account" drupal page)

I have used grep to search files, but can't locate the .tpl.  The .tpl being used is not displayed in the HTML source like it usually is.

Try CiviTeacher: the online video tutorial CiviCRM learning library.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: What is the CiviCRM file to edit the /user/<username> page in Drupal My Account?
August 28, 2010, 04:09:01 pm
I think you want to use a drupal hook - code below is an example of I hook I wrote to change the drupal member since to reflect the earliest CiviCRM membership date rather than the user account creation date - it's the same hook you'll want.

Code: [Select]
<?php
// $Id: 

/**
 * @file
 * Customizes the user profile page to show when they became a civimember rather than a drupal user.
 * extra function shows when membership with latest expiry date will expire.
 * Start -date logic gets earliest membership start-date where membership status is not pending or cancelled and
 * it is not a test registration.
 * Expiry logic gets latest membership end-date where no pending registrations exist and the given registration is not pending or cancelled
 */

/**
 * Implementation of hook_profile_alter().
 */
function civialterprofilepage_profile_alter(&$account) {
if ( ! civicrm_initialize( ) ) {
        return;
    }
  require_once(
'api/v2/UFGroup.php');
  
$contactID = civicrm_uf_match_id_get($account->uid);
  require_once(
'api/v2/MembershipContact.php');
  
$memberships = civicrm_membership_contact_get($contactID);
  
$origDate = $startDate = mktime(0, 0, 0, 1, 1, 3000);
  
$origEndDate = $endDate = mktime(0, 0, 0, 1, 1, 1980);
  
$params = array();
  require_once(
'api/v2/MembershipStatus.php');
  
$membershipStatuses = civicrm_membership_status_get(&$params);

  
// Get membership statuses & determine pending & cancelled statuses IDs to exclude these
  // from those reported
  
foreach ($membershipStatuses as $statusID){
  if ($statusID['name'] == 'Pending' || $statusID['name'] == 'Cancelled'){
$statusIDRange[]=$statusID['id'];
if ($statusID['name'] == 'Pending'){
$pending = $statusID['id'];
}
  }
  }

  foreach (
$memberships[$contactID] as $contact=>$membership){

if ($membership['is_test'] == 0 && $membership ['member_is_test'] == 0 && $membership['membership_start_date'] && !(in_array($membership['status_id'] ,$statusIDRange)  )) {

$membershipStartDate = convert_date($membership['membership_start_date']);
$membershipEndDate = convert_date($membership['membership_end_date']);
if ( $membershipStartDate < $startDate){
 $startDate = $membershipStartDate;
}
if ( $membershipEndDate > $endDate){
$endDate = $membershipEndDate;
}
}else if($membership['is_test'] == 0 && $membership ['member_is_test'] == 0 && $membership['status_id'] == $pending){
// if they have a pending registration (or any sort) suppress information regarding the expiry date in order to prevent confusion

$suppressExpired = 1;

}
  }



  if (
$startDate < $origDate){
  $account->content['summary']['#title'] = t('Membership');
  $account->content['summary']['member_for']['#title'] = t('You have been a member since');

  $account->content['summary']['member_for']['#weight'] = -19;
  $account->content['summary']['member_for']['#value'] = t(date("d F Y", $startDate));
  if ($endDate >  $origEndDate && !$suppressExpired == 1){
  if ($endDate > time()){
  $tense  = "will expire";
  }else {
     $tense  = "expired";
  }

  $account->content['summary']['member_expires']['#title'] = t("Your membership $tense on ");
  $account->content['summary']['member_expires']['#weight'] = -18;
  $account->content['summary']['member_expires']['#value'] = t(date("d F Y", $endDate));
  $account->content['summary']['member_expires']['#type'] = 'user_profile_item';
  }

  }

}

function 
convert_date($datestring){
$dateArr = explode("-",$datestring );
$dateInt = mktime(0,0,0,$dateArr[1],$dateArr[2],$dateArr[0]) ;
return 
$dateInt;
}
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: What is the CiviCRM file to edit the /user/<username> page in Drupal My Account?
August 28, 2010, 07:02:17 pm

Those two lines are added by the code: drupal/civicrm.module (function civicrm_view_data)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • What is the CiviCRM file to edit the /user/<username> page in Drupal My Account?

This forum was archived on 2017-11-26.