Hello.
I have multiple Profiles activated on jomsocial latest version.
User - Team - Partner - Gold
I want to be able to show a different joomla module to each profile. Example:
On USER, i want to show a standard html module to invite users to pay
On PARTNET, i want to a standard html show a module to congratulate being a partner.. etc etc..
I Think you get the idea..
Please advise.
Thank you
Hi.
JomSocial multiprofiles are not recognized by Joomla! in any way so you can't assign a module to be displayed only for certain Profile.
This can be done ONLY inside JomSocial. We use built-in module positions you could create some new positions in internal sidebar and add a condition that this particular module position is loaded ONLY if user that uses certain multiprofile is logged in.
But you need to specify on what pages you want to display those modules. Then I could write a code snippet for you.
Thank you for the fast reply.
Lets suppose that the module i want to be shown its independent of jomsocial content...
I don't want any hack to the jomsocial. I just pretend that, if some user is logged in jomsocial with a specific multiprofile named PARTNER for example, then joomla it self shows a html module or banner inside the page and outside the jomsocial standard modules.
Thank you
Hi.
Hmmm, I think it still could be done... it will require a SQL query in the template as we'll have logged in user ID already, so wee need to find what Profile ID he/she is related too. So we di a check and load certain ID to variable, then we create condition with module position... yes, this could be done that way.
Just confirm that you are interested in that kind of custom code.
My customizations are SAFE HACKS done with template overrides and NO CORE file hacks ;)
Hi.
No, this will not cost you a thing ;)
I prepared code snippet. This hack NEED TO BE APPLIED INTO CURRENT (DEFAULT) TEMPLATE.
Template may differs with the way modules are rendered. My hack should work with most templates as I used standard method of module rendering.
You'll need to edit index.php of your template (if you use T3 framework based template or any other frameworked template then you'll need to find yourself right place where sidebars are loaded)
In my example I'll use Protostar template as default Joomla! 3.x.x template.
Edit file ROOT/templates/protostar/index.php. In line 174 starts RIGHT sidebar. Here we'll add our code so any module assigned to multiprofile ID will be loaded before any other modules - so on top of column).
After line 174 add this code:
<?php
$user = JFactory::getUser();
$user_profile_id = $user->getProfileType();
?>
<?php if($user_profile_id == 2) { ?>
<jdoc:include type="modules" name="position-name" style="style-name" />
<?php } ?>
<?php if($user_profile_id == 2) { ?>
<jdoc:include type="modules" name="position-name" style="style-name" />
<?php } ?>
There is no need to use additional query to get the id of the profiletype, once you have the proper JomSocial user object.
You can extract the profile type ID from the object directly
$cuser = CFactory::getUser();
$data = $cuser->getProfileType();
echo $data;
Thank you Michal and Sinisa for the excellent support.
I'm glad i bought this software.
I'm going to try to implement this features on my template and i will give some feedback.
Once again Thank you