Support Forum

Welcome! Support Forums have been reactivated

Support Times

Support team is available Monday to Friday
From 12AM to 4PM (UTC Time)

How to load custom style for specific user group?

1 week 3 days ago
Licenses:
JomSocial Active

Hello.
I created "VIP" joomla user group and would like to display some specific styles for it (another color for avatar border: red instead of white)



For example, as default, there is style:
.joms-avatar img, .joms-avatar--stream img, .joms-avatar--comment img, .joms-avatar--focus img, .joms-avatar--video img {
display: inline-block;
line-height: 0;
padding: 3px;
background: #fff;
}


I would like to display "background: #000;" if joomla user group = 10. How can I do it?
I read documentation.jomsocial.com/wiki/Add_the...he_Joomla_User_Group and documentation.jomsocial.com/wiki/Template_Developer_Kit

I set "demo" user to "VIP" group (ID = 10).
I uploaded file "general.header.php" to folder: /templates/my_joomla_template/html/com_community/layouts/

this file contain code:
<?php
// Lets obtain the user object first
$juser = CFactory::getUser(); // Get the user object you want to display the badge for. On profile page you can use $juser = CFactory::getRequestUser(); to obtain the user object of the user we are looking at.
$juserid = $juser->id; // extract the user ID

// Now, lets get the array of all Joomla User Groups user is member of
jimport( 'joomla.user.helper' );
$groups = JUserHelper::getUserGroups($juserid);
?>


And this:
<!-- Display the badge if user is member of the Joomla User Group with ID 8 -->
<?php if(in_array(10, $groups)): ?>
<style>
.joms-avatar img, .joms-avatar--stream img, .joms-avatar--comment img, .joms-avatar--focus img, .joms-avatar--video img{
background: #ff0000 !important;
}
</style>
<?php endif ?>


but this style (#ff0000) apply only if user (from group ID=10) is loged. It apply only for him.

Can you please help with it?

Thanks.


Sorry for my English
Attachments:

Please Log in or Create an account to join the conversation.

1 week 3 days ago
  • Dimas's Avatar
  • Dimas
  • Offline
  • Administrator
  • Posts: 12575
  • Thank you received: 3267
Licenses:
JomSocial Active GURU Active Publisher Expired AdAgency Expired iSEO Expired Socialize Expired

Hi,

ON this code :

$juser = CFactory::getUser();
it will get the logged user id by default, so please change to this code
$juser = CFactory::getUser(USER_ID);
that code will apply any user depending the "USER_ID"

I hope it will help.

Please Log in or Create an account to join the conversation.

1 week 1 day ago
Licenses:
JomSocial Active

Hi. I changed code, but can't see the difference.
Wnen I visit site like guest, everything looks as usual.
New style still apply only when I logging as "demo" (joomla user group 10). And it apply for all users:



I supposed that:
1) this style will apply only for VIP-users's avatar border.
2) anybody can see this style (not only VIP-users) - like "NO LICENSE" badge at jomsocial.com.

Seems I was mistaken. So, how does it work?
How to apply some extra color / background for VIP-users?

Thanks.


Sorry for my English
Attachments:

Please Log in or Create an account to join the conversation.

6 days 5 hours ago
  • Dimas's Avatar
  • Dimas
  • Offline
  • Administrator
  • Posts: 12575
  • Thank you received: 3267
Licenses:
JomSocial Active GURU Active Publisher Expired AdAgency Expired iSEO Expired Socialize Expired

Hi,

Where do you want to apply it? for all page? its hard to be implmented.. its really tricky because you need modify many files, for the pointer code you can use this

$user  = JFactory::getUser(USER_ID);
$user_groups = $user->groups;
// check if this user have VIP id
print_r($user_groups);

Please Log in or Create an account to join the conversation.

5 days 19 hours ago
Licenses:
JomSocial Active

Hi.
I supposed that it's possible to do something like that.
For example, simple user's activity looks loke this:



But if user in specific group (or may be JS-Featured user) I would like to display not budge but some custom styles:

ts really tricky because you need modify many files

Seems I really need to edit this stream activity temlate layout (make override) and "display some extra class if user is VIP"?

Anyway, I don't know how to use your new code:

$user = JFactory::getUser(USER_ID);
$user_groups = $user->groups;
// check if this user have VIP id
print_r($user_groups);


In this code? :(

<?php
// Lets obtain the user object first
$juser = CFactory::getUser(USER_ID); // Get the user object you want to display the badge for. On profile page you can use $juser = CFactory::getRequestUser(); to obtain the user object of the user we are looking at.
$juserid = $juser->id; // extract the user ID
// Now, lets get the array of all Joomla User Groups user is member of
jimport( 'joomla.user.helper' );
$groups = JUserHelper::getUserGroups($juserid);
?>


I planned to use "VIP" and "PRO" user statuses. But seems the best way is to use "Multiple Profiles" feature to make this profile typoes looks different?

I wish "Featured users" (default JS option) could get some extra class by JS as default everywhere.

Can you please tell what files was edited to display "JS ACTIVE" badge at jomsocial.com? :)

Thanks.


Sorry for my English
Attachments:

Please Log in or Create an account to join the conversation.

5 days 8 hours ago
  • Dimas's Avatar
  • Dimas
  • Offline
  • Administrator
  • Posts: 12575
  • Thank you received: 3267
Licenses:
JomSocial Active GURU Active Publisher Expired AdAgency Expired iSEO Expired Socialize Expired

Hi,

That is smart solution, user jomsocial profile type and use watermark avatar for difference the general user with VIP user.

Create profile type, on Jomsocial backend->Profile->Multiple Profiles->create new profile type, and on the form upload "Watermark" config item.

thank you!

Please Log in or Create an account to join the conversation.

5 days 6 hours ago
Licenses:
JomSocial Active

Hi. Can you please tell what file(s) was edited to display "JS ACTIVE" badge at jomsocial.com and may be publish code from it (because code from documentation apply for me only after login)?

I would like to display some badge like there.

Thanks.


Sorry for my English

Please Log in or Create an account to join the conversation.

4 days 6 hours ago
  • Dimas's Avatar
  • Dimas
  • Offline
  • Administrator
  • Posts: 12575
  • Thank you received: 3267
Licenses:
JomSocial Active GURU Active Publisher Expired AdAgency Expired iSEO Expired Socialize Expired

JS active? please explain more..

Please Log in or Create an account to join the conversation.

4 days 6 hours ago
Licenses:
JomSocial Active

Hi. I mean this badge that was mentioned in documentation.


Thanks.


Sorry for my English
Attachments:

Please Log in or Create an account to join the conversation.

4 days 6 hours ago
  • Dimas's Avatar
  • Dimas
  • Offline
  • Administrator
  • Posts: 12575
  • Thank you received: 3267
Licenses:
JomSocial Active GURU Active Publisher Expired AdAgency Expired iSEO Expired Socialize Expired

we use custom code, I dont recommended you to use custom / hack method, your issue actually can be fixed easily, just activate multiprofile and create watermark avatar there

Please Log in or Create an account to join the conversation.

2 days 17 hours ago
Licenses:
JomSocial Active

Hi. Is it possible to use "if Featured user" condition?

Should I add this code to general.header.php:

$featured = new CFeatured(FEATURED_USERS);
$featuredList = $featured->getItemIds();

- or I need to use another code in this file?

And this one to place where need to display badge?

<?php if (is_array($featuredList) && in_array($row->user->id, $featuredList)) { ?>
custom badge or class-style
<?php } ?>

or may be this one:

<?php echo ($profile->featured == true) ? 'CUSTOM-CODE-THERE' : ' '; ?>


but it didn't helped.
Thanks.


Sorry for my English

Please Log in or Create an account to join the conversation.

2 days 6 hours ago
  • Dimas's Avatar
  • Dimas
  • Offline
  • Administrator
  • Posts: 12575
  • Thank you received: 3267
Licenses:
JomSocial Active GURU Active Publisher Expired AdAgency Expired iSEO Expired Socialize Expired

Hi,

I am sorry your request is too many hack tehnical issue, and that is not simple hack, I suggest you hire 3rd party developer.

thank you!

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum