By Tony Boutemeur on Sunday, 19 January 2020
Posted in General Issues
Replies 3
Likes 0
Views 402
Votes 0
Hello,

I would like load this part

style="<?php echo $customStyle;?>"
from /administrator/components/com_easysocial/themes/default/html/html.user.php

I think I need of this:

<?php echo $this->html('html.user', $user); ?>


My aim is getting the background label for each user category and loading this background label behind the user avatar for getting a kind of badges color around the user avatar depending of his own user category

Could you help me for calling $customStyle?

Thank you for your help
Hey there,

Can you have a try on the follwoing PHP code and see how it goes:

// Get the current user Id
$id = JFactory::getUser()->id;

$user = ES::user($id);

$profile = $user->getProfile();
$profileParams = $profile->getParams();

$customStyle = '';
$styles = array();

if ($profileParams->get('label_colour') && $profileParams->get('label_font_colour')) {
$styles[] = 'color: ' . $profileParams->get('label_font_colour');
}

if ($profileParams->get('label_background') && $profileParams->get('label_background_colour')) {
$styles[] = 'background: ' . $profileParams->get('label_background_colour');
$styles[] = 'padding: 1px';
}

if ($styles) {
$customStyle = implode(';', $styles);
}

// After that, $customStyle is ready to use.
·
Monday, 20 January 2020 11:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Irwin,

Thank you so much for your help. It works.

Best regards,
Tony
·
Monday, 20 January 2020 17:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You are most welcome.

Just for your information, I have locked and marked this thread as resolved to avoid confusions in the future. Please start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiries.

Thanks for understanding.
·
Monday, 20 January 2020 17:11
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post