Hi all,
how can I put a custom button on the 'about me' section of a profile. Since I've implemented a platform with two different profiles (say A and B) I would like to put this costum button only on profile of type A.
How can this be made? Can you give me a little hack I can use?
Thank you very much!
Hi Alfonso,
all customization must be done by using override method:
documentation.jomsocial.com/wiki/Customizing_Template
so at upgrade process you will not lose any customization. here the steps for your purpose:
1. copy userinfo.php from /components/com_community/templates/default/modules/profile/ to /templates/[your front end template]/html/com_community/modules/profile/
2. at line 78 you can find "about me" link
<li><a href="#" class="about js-collapse-about-btn"><?php echo JText::_('COM_COMMUNITY_ABOUT_ME')?></a></li>
Thanks Albertus,
can you explain a little bit more how can I paste a button in it? You know on the blank space aside of all the profile information. Most of all, how can I paste it only on one profile type instead of both of them?
I'm not so skilled, be patient with me :)
Thank you man!
Hi Alfonso,
could you please provide me the screenshot to pointing me, where is the exactly position do you want. and also, give the code for that new button.
please edit your first post at this topic. and put credential information: administrator, FTP, site URL at site info form.
I will do it for you. and let you know what I did.
Regards,
Albert
Hi Albertus thanks again,
I've attached an image so that you can see the area where I want to put the button, unfortunately I'm working locally on the site so I don't know if you'll be able to work directly on it. By the way could you just write an example code I can use for this purpose so I can try it out? The image you will see shows you the 'about me' section collapsed with a blank area aside of all the profile informations, that's where I want to put the button, more or less centered in that area.
Thank you for your patience man, I really appreciate it.
Alfonso
Hi Alfonso,
you can do it by using overrides:
documentation.jomsocial.com/wiki/Customizing_Template
1. copy userinfo.php from /components/com_community/templates/default/modules/profile/ to /templates/[your active template]/html/com_community/modules/profile/
2. around line 120, find this code
<div class="collapse js-collapse-about">
<div class="row-fluid">
<div class="span12">
<div><?php echo $about; ?></div>
<dl class="dl-horizontal">
<dt><?php echo JText::_('COM_COMMUNITY_MEMBER_SINCE'); ?></dt>
<dd><?php echo JHTML::_('date', $registerDate , JText::_('DATE_FORMAT_LC2')); ?></dd>
<dt><?php echo JText::_('COM_COMMUNITY_LAST_LOGIN'); ?></dt>
<dd><?php echo $lastLogin; ?></dd>
<?php if( $multiprofile->name && $config->get('profile_multiprofile') ){ ?>
<dt><?php echo JText::_('COM_COMMUNITY_PROFILE_TYPE'); ?></dt>
<dd><?php echo $multiprofile->name;?></dd>
<?php } ?>
</dl>
</div>
</div>
</div>
<div class="collapse js-collapse-about">
<div class="row-fluid">
<div class="span6">
<div><?php echo $about; ?></div>
<dl class="dl-horizontal">
<dt><?php echo JText::_('COM_COMMUNITY_MEMBER_SINCE'); ?></dt>
<dd><?php echo JHTML::_('date', $registerDate , JText::_('DATE_FORMAT_LC2')); ?></dd>
<dt><?php echo JText::_('COM_COMMUNITY_LAST_LOGIN'); ?></dt>
<dd><?php echo $lastLogin; ?></dd>
<?php if( $multiprofile->name && $config->get('profile_multiprofile') ){ ?>
<dt><?php echo JText::_('COM_COMMUNITY_PROFILE_TYPE'); ?></dt>
<dd><?php echo $multiprofile->name;?></dd>
<?php } ?>
</dl>
</div>
<div class="span6">
[put your custom button code at here]
</div>
</div>
</div>
Thank you very much Albertus!
This hack works just fine, i've got one last issue to fix: I need the button to be shown only on a profile type since in my community I have two different profiles. Right now the button appears on both profile types. Can you give me a little code for this too?
Thanks again, I wish you a great 2015!
Alfonso
Hi Alfonso,
You can use this code :
<?php if( $multiprofile->name=="YOUR_PROFILE_TYPE" && $config->get('profile_multiprofile') ){ ?>
<dt><?php echo JText::_('COM_COMMUNITY_PROFILE_TYPE'); ?></dt>
<dd><?php echo $multiprofile->name;?></dd>
<?php } ?>
Hi Dimas,
I've tryed your hack but nothing happens, the button is still showed on both profile types; here it is:
<?php if( $multiprofile->name=="BAND" && $config->get('profile_multiprofile') ){ ?>
<dt><?php echo JText::_('COM_COMMUNITY_PROFILE_TYPE'); ?></dt>
<dd><?php echo $multiprofile->name;?></dd>
<?php } ?>
</dl>
</div>
<div class="span6" style="position:relative;left:150px;top:180px">
<button class="btn btn-large btn-primary" type="button">Hire Band!</button>
</div>
</div>
</div>
</div>
</div>
</div>
What's wrong with that?
Thank you very much for your help, I really appreciate it.
Alfonso
HI Alfonso,
Please provide me backend access and FTP access on private info, I will change it directly.
thank you
Hi Dimas, thanks again for your kind reply
unfortunately I'm working locally on the site so I don't know if you'll be able to work directly on it; btw if you write me the whole code I can try and tell you if everything is ok.
Thanks for your support.
Alfonso
Hi Alfonso,
Please you debug to print $multiprofile->name, make sure the print out is same with your if conditional.
Hard for us to inspect your issue further, if I cant see and test your issue directly.
thank you