Support

  1. Mannfredos
  2. General
  3. Friday, December 02 2016, 10:54 AM
I would like to have the group membership displayed in profile. Is this possible?
admin Accepted Answer
Admin
Hi,
sorry this is not possible natively.

To do this you need to override profile template and add custom code, follow these steps:
- Copy file from /components/com_jsn/views/profile/tmpl/default.php to /templates/your-template-folder/html/com_jsn/profile/default.php
- in the new file add this code after line 101
<?php 
$db=JFactory::getDbo();
$query=$db->getQuery(true);
$query->select('title')->from('#__usergroups')->where('id IN ('.implode(',',$user->getAuthorisedGroups()).')');
$db->setQuery($query);
$result=$db->loadColumn();
echo '<div>Member of: '.implode(', ',$result).'</div>';
?>
  1. more than a month ago
  2. General
  3. # 1
admin Accepted Answer
Admin
Hi,
sorry but we will not add this feature because we do not want to expose usergroups in frontend.

Although is this solution up there still working. It doesn't for me.
try with this code:
<?php 
$db=JFactory::getDbo();
$query=$db->getQuery(true);
$query->select('title')->from('#__usergroups')->where('id IN ('.implode(',',$this->user->getAuthorisedGroups()).')');
$db->setQuery($query);
$result=$db->loadColumn();
echo '<div><b>Member of:</b> '.implode(', ',$result).'</div>';
?>


As a feature I would like to have it as a custom field rather than a fixed info beneath the name.
The faster way is to use a plugin like Sourcerer (https://www.regularlabs.com/extensions/sourcerer) and put the code below in HTML delimiter field type (see Screenshot)
{source}
<?php
$db=JFactory::getDbo();

$user = JFactory::getUser(JRequest::getVar('id',null));
$query=$db->getQuery(true);
$query->select('title')->from('#__usergroups')->where('id IN ('.implode(',',$user->getAuthorisedGroups()).')');
$db->setQuery($query);
$result=$db->loadColumn();
echo implode(', ',$result);
?>
{/source}


NOTES:
- HTML delimiter field type allow you to put a static test in a field position (http://docs.easy-profile.com/index.php/article/html-delimiter-field-type)
- Sourcerer plugin allow you to use PHP code in the all parts that load Joomla content plugins (like HTML delimiter field type)
Attachments (1)
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Sorry, but I can not understand, can you explain me better?

Memberships from which component?
  1. more than a month ago
  2. General
  3. # 3
Mannfredos Accepted Answer
Sorry, my english is not so good. From Joomla. I have several user groups in Joomla and would like to see them in the profile.
  1. more than a month ago
  2. General
  3. # 4
ZubzEr Accepted Answer
Hey.
I really want to back this idea up and maybe we will find this feature in one of the upcoming releases. It would be most useful to be able to view / display the usergroup(s) a user is in in their profile.

Going to try this custom workaround. Thanks!
  1. more than a month ago
  2. General
  3. # 5
ZubzEr Accepted Answer
Although is this solution up there still working. It doesn't for me.
As a feature I would like to have it as a custom field rather than a fixed info beneath the name.
Or is it yet possible to do this with some custom sql query?
  1. more than a month ago
  2. General
  3. # 6
ZubzEr Accepted Answer
Content Protected
  1. more than a month ago
  2. General
  3. # 7
admin Accepted Answer
Admin
Hi,
sorry for late reply, it's a weekend for us.

try with this code


{source}<?php
$db=JFactory::getDbo();
$id = JFactory::getUser(JRequest::getVar('id',null));
$query=$db->getQuery(true);
$query->select('title')->from('#__usergroups')->where('id IN (SELECT group_id FROM #__user_usergroup_map WHERE user_id = '.(int)$id.')');
$db->setQuery($query);
$result=$db->loadColumn();

echo implode(', ',$result);

?>{/source}
  1. more than a month ago
  2. General
  3. # 8
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.