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?
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!!!
Please GIve me suggations on how to remove the History ( lying in the profile).
Please! Please!! please!!! help!!!!
customize it
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!!!
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
Editing core code is a bad idea. Your changes will get wiped out on an upgrade.
Maybe a bit late, but it
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
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
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
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
this is correct way http://drupal.org/node/35728
(use profile module in core)
1) create in template.php function phptemplate_user_profile
<?phpfunction 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
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,
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?
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
How does that history data get there?
?
?
=-=
its part of core.
hook_profile_alter
There is a hook_profile_alter to modify this, just implement it in a module:
<?phpfunction mymodule_profile_alter(&$account, &$fields) {
foreach ($fields AS $category => $items) {
if($category == 'History') {
unset($fields[$category]);
}
}
}
?>
don't forget about t() function
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
how would be this code for Drupal6?
In Drupal6, create a file in
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
try the code but nothing happened, could you give any detail missing please?
Clear Cache...
Clear your drupal cache under: www.example.com/admin/settings/performance in order for this change to take effect.
...or make a custom module
...or make a custom module and put this inside:
<?phpfunction 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
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.