By Fagault Eric on Monday, 30 January 2017
Posted in General
Likes 0
Views 127
Votes 0
Hello,
I would like to know if it is possible to recover the ID in the place of the target in this variable?


$utilisateur = $this->html('html.user', $target);

<?php echo JText::sprintf('APP_USER_FRIENDS_STREAM_IS_NOW_FRIENDS_WITH', $this->html('html.user', $actor), $this->html('html.user', $target)); ?>


Best regards.
Eric
I am not too sure which location is this but if it is an object, you could get the "id" from the $target or $actor. Example:


echo $actor->id;
echo $target->id;


I am really sorry but we are unable to assist you further on this as it is beyond the scope of our support.
·
Monday, 30 January 2017 23:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you very much, indeed it is much simpler than what I had imagined.
By cons, thus recovering the username, I can no longer format it.
The CSS have no influence.
Best regards.
Eric
·
Monday, 30 January 2017 23:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, not really sure if I understand you but I guess your issue is resolved now?
·
Monday, 30 January 2017 23:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you very much, your team is fantastic.
I had built before with CB, (2 years ago) but I assure you that you are much more efficient.

The result (Although to display the Username I think I'm not going in the best direction)

Best regards.
Eric


<?php
/**
* @package EasySocial
* @copyright Copyright (C) 2010 - 2016 Stack Ideas Sdn Bhd. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* EasySocial is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
?>

<?php echo JText::sprintf('APP_USER_FRIENDS_STREAM_IS_NOW_FRIENDS_WITH', $this->html('html.user', $actor), $this->html('html.user', $target)); ?>

<?php
$results = $target->id;

$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName('username'));
$query->from($db->quoteName('#__users'));
$query->where($db->quoteName('id') . ' = '. $db->quote($results));
$db->setQuery($query);
$utilisateur = $db->loadResult();

// User info
echo '<p><div style="margin-left:18%;margin-top:5%;font-size:20px;position:absolute;font-weight:700;padding-left:1%;color:#fff;z-index:10">'.$utilisateur.'</div><p>';

// Cover
$amicover = ES::user($results);
//echo $amicover->getCover();
echo '<p>
<div class="mod-es-pf-hd__cover-wrap" style="margin-top:20px;margin-left:1%">
<div class="mod-es-pf-hd__cover" style="z-index:1;width:100%;height:100%;border:solid 1px #c2c2c2;auto;
background-image:url('.$amicover->getCover().');
background-position: 0% 25.771428571429%;">
</div>
</div>';

$amiavatar = ES::user($results);
//echo $amicover->getAvatar();
echo '<p><div style="position:absolute;margin-left:3%;margin-top:-22%;padding:3px;border:solid 1px #c2c2c2;z-index:10;background:#fff">
<img src="'.$amiavatar->getAvatar().'"/></div> <p><p>';
?>
·
Monday, 30 January 2017 23:29
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, you really don't need to query the database to get the username. You can just use this code to get the username,

[gist]
echo $target->username;
[/gist]
·
Monday, 30 January 2017 23:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello thank you very much.

$ Results = $ target-> id;
Perfectly meets what I need

Now I will try to display the Gender, the City ...
Different information provided in the profile.

Cordially.

Eric
·
Tuesday, 31 January 2017 17:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating, glad that your issues are resolved now.
·
Tuesday, 31 January 2017 17:42
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post