How can I remove History from profile.

surajsapkota - April 21, 2007 - 12:50

When I View Profile I always see History (Member for .. days ..hours). I don't like it and I would like to remove it. But How? Please help me?

Please help!!!

surajsapkota - April 25, 2007 - 16:18

Please GIve me suggations on how to remove the History ( lying in the profile).

Please! Please!! please!!! help!!!!

customize it

azim - April 26, 2007 - 08:06

You would have to check http://drupal.org/node/35728

I wouldn't know any other simpler way. Am trying to edit them myself too.

Re: Please help!!!

bwalls - May 15, 2007 - 22:27

I went and opened the user.module file in word pad, searched for history, and deleted that whole line of code. That seems to have worked for me.

Editing core code is a bad

ceejayoz - January 21, 2008 - 14:43

Editing core code is a bad idea. Your changes will get wiped out on an upgrade.

Maybe a bit late, but it

runacid - October 27, 2007 - 16:00

Maybe a bit late, but it does work that way!

Open the user.module file in the Module>>user folder and comment out line 458 to 466 (including the '}')
(tested with Durpal 5.2)

Help me please

Insane Fisher - December 5, 2007 - 04:27

Hi. I am also looking to remove the history from the views in profile. Do I actually have to count the lines?!!? How do I know which lines are are 458 to 466, a how do I comment something out?

Thanks!
Insane Fisher
www.insanefishingclub.com

I am the building. I am the tree. I am God, for God's in me.

Just saw your post.. Well I

runacid - January 13, 2008 - 23:31

Just saw your post..
Well I don't know any other way of doing it. Just get some basic code editor which is capable of counting the lines. (I use "proton", which is really nothing fancy)
There are some really powerful tools out there for free as well, for example Eclipse. Instead of deleting the relevant code, you could also just comment it out,

i am correct 1 line (num

selff - January 21, 2008 - 10:04

i am correct 1 line (num 474) in this block code:

<?php
/**
* Implementation of hook_user().
*/
function user_user($type, &$edit, &$user, $category = NULL) {
  if (
$type == 'view') {
   
$items['history'] = array('title' => t('Member for'),
     
'value' => format_interval(time() - $user->created),
     
'class' => 'member',
    );

    return array();
//t('History') => $items

// ...
?>

instead return array(t('History') => $items);
write this return array();

correct way

selff - January 21, 2008 - 11:53

this is correct way http://drupal.org/node/35728
(use profile module in core)
1) create in template.php function phptemplate_user_profile

<?php
function phptemplate_user_profile($user, $fields = array()) {
return
_phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields));
}
?>

2) create file user_profile.tpl.php and output what you want,
test:
<div>
    <h3>$USER:</h3>
    <?php foreach($user as $k=>$v)
        if (
is_array($v)) foreach($v as $kk=>$vv) print "--$kk=$vv<br />\n";
        else print
"$k=$v<br />\n";
       
?>


    <h3>$FIELDS:</h3>
    <?php foreach($fields as $k=>$v) {
        if (
is_array($v)) {
            foreach(
$v as $kk=>$vv) {
                if (
is_array($vv)) foreach($vv as $kkk=>$vvv) print "-- -- $kkk=$vvv<br />\n";
                else print
"-- $kk=$vv<br />\n";
            }
        }
        else print
"$k=$v<br />\n";
        }
       
?>

</div>

Correct way - module level

MarcoR - April 10, 2008 - 14:43

You should not correct drupal's output by changing drupal's code.
If you want to change functionality instead of appearance, you should choose to modify drupal's output in a custom module. In the example, you would have a module called mywebsite. Into the file mywebsite.module you put the following code:

<?php
/**
* Implementation of hook user to do some customization of this website
*/
function mywebsite_user($type, &$edit, &$user, $category = NULL) {
  if (
$type == 'view') {
   
// turn off history by returning an empty array having the same key as the one defined in user_user()
   
$items['history'] = array();
    return array(
t('History') => $items);
  }
}
?>

Put the file into /sites/all/modules/custom/mywebsite directory. Put an according mywebsite.info into the directory, too. Activate the module as usual. More information in module developer guide.

I'm having the same issue,

leanazulyoro - July 26, 2008 - 18:45

I'm having the same issue, and i tought it would be as easy as you say MarcoR, in theory that should do it, but it doesn't :S, have you tried it? or you just came up with it and suggested it without trying?

MyAccount_alter module?

rgammon - April 21, 2008 - 15:42

There appears to be a module that can do this: http://drupal.org/project/myaccount_alter

"Gets rid of unwanted sections on the 'My Account' page such as the 'History' section or anything added there by a contributed module.

"Install, then go to the myaccount_alter settings page and check off the sections you would like to disable."

I haven't used it, but was searching site on similar keywords and thought this might be a good lead for you. I note the module was updated 2008-Feb-16 (rel. 5.x-1.2), which indicates its a living project.

How does that history data

robb0632 - July 13, 2008 - 18:13

How does that history data get there?

?

robb0632 - July 29, 2008 - 13:44

?

=-=

VeryMisunderstood - July 29, 2008 - 13:53

its part of core.

hook_profile_alter

leanazulyoro - July 29, 2008 - 18:00

There is a hook_profile_alter to modify this, just implement it in a module:

<?php
function mymodule_profile_alter(&$account, &$fields) { 
    foreach (
$fields AS $category => $items) {
        if(
$category == 'History') {
            unset(
$fields[$category]);
        }
      } 
}
?>

don't forget about t() function

sobi3ch - August 6, 2008 - 16:35

If you using other language then default English, don't forget about t() function other wise above code will not work.
I've change 'History' > t('History')

<?php
/**
* implementation of hook_profile_alter
*/
function mymodule_profile_alter(&$account, &$fields) {
  foreach (
$fields AS $category => $items) {
    if(
$category == t('History')) {
      unset(
$fields[$category]);
    }
  }
}
?>

how would be this code for

mortenson - September 29, 2008 - 18:43

how would be this code for Drupal6?

In Drupal6, create a file in

mechler - November 10, 2008 - 16:54

In Drupal6, create a file in your theme's directory called: user-profile.tpl.php

Give that file the following contents:

<div class="profile">
<?php
unset($profile[t('summary')]);
foreach (
$profile AS $k => $v) {
  print
$v;
}
?>

</div>

That's all I did to remove that section. Hope this helps!

try the code but nothing

mortenson - November 10, 2008 - 18:27

try the code but nothing happened, could you give any detail missing please?

Clear Cache...

drubeedoo - January 27, 2009 - 03:45

Clear your drupal cache under: www.example.com/admin/settings/performance in order for this change to take effect.

...or make a custom module

magnestyuk - January 13, 2009 - 02:40

...or make a custom module and put this inside:

<?php
function mymodule_profile_alter(&$account) {
  foreach (
$account->content AS $key => $field) {
      if (
$key=='summary') {
      unset(
$account->content['summary']);
    }
  }
}
?>

Remove Profile history "Member for" for Drupal 6

AdAstra - March 22, 2009 - 23:07

Write your own custom module and put this code in it:

/**
* Implementation of hook_profile_alter
*/
function custom_profile_alter(&$account) {
unset($account->content['summary']['#title']);
unset($account->content['summary']['member_for']);
}

---------------------------------------------------
AdAstra.ca - Optimize the Web. Optimize the World.

 
 

Drupal is a registered trademark of Dries Buytaert.