By Fagault Eric on Thursday, 24 August 2017
Posted in General
Likes 0
Views 1K
Votes 0
Hello,
To invite members of the network to join a group, like a page, participate in an event, I want to modify the invitation tool to propose the list of the friends of the member who wishes to invite other members.
I would like to propose (in the toolpic) the list of friends with their avatar, their username and an "Invite" button.
What file is used in this toolpic?

Best regards.

Eric
Hi Eric,

You can find the file that populate in the toolpic in :
[pages]: .../components/com_easysocial/themes/wireframe/pages/item/default.php
[group]: .../components/com_easysocial/themes/wireframe/groups/item/default.php
[event]: .../components/com_easysocial/themes/wireframe/events/item/default.php

and find it under class="dropdown-menu dropdown-menu-right"
·
Thursday, 24 August 2017 16:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you very much,
This opens a window, it is the content of this window that I would like to modify, to display the list of the friends of the member to launch the invitations.
Which file is it?

Best regards.

Eric
·
Thursday, 24 August 2017 16:53
·
0 Likes
·
0 Votes
·
0 Comments
·
I have located the affected files.
\ Components \ com_easysocial \ themes \ wireframe \ groups \ dialogs \ invite.php
(For groups)

I'm now looking for where is "data-textboxlist-textField" used here (I find several when I do a search) and I wonder, why does this kign present twice in the file?
·
Thursday, 24 August 2017 17:23
·
0 Likes
·
0 Votes
·
0 Comments
·
I have located the affected files.
\ Components \ com_easysocial \ themes \ wireframe \ groups \ dialogs \ invite.php
(For groups)

I'm now looking for where is "data-textboxlist-textField" used here (I find several when I do a search) and I wonder, why does this kign present twice in the file?


I was thinking of using a SQL type field in this style:

<Field name = "ListUsers"
type = "sql"
multiple = "true"
Query = "SELECT Username AS username FROM #__users"
key_field = "username"
value_field = "id"
Label = "Name"
></Field>
·
Thursday, 24 August 2017 17:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Eric,

May I know the main purpose of the query, is it you want to invite non-friend into the group when you type it in the textfield?
If yes, actually we have the setting to invite non-friend by: settings>groups>general>allow Inviting Non Friends
·
Thursday, 24 August 2017 20:02
·
0 Likes
·
0 Votes
·
0 Comments
·
Fadhli,
In fact, I want to propose the list of friends with avatar and name for example, instead of a zone of entry where it is necessary to enter the name of the friend.
Best regards.
Eric
·
Thursday, 24 August 2017 20:17
·
0 Likes
·
0 Votes
·
0 Comments
·
I see, perhaps you can use the code below:
[gist type="php"]
$id = $this->input->get('userid', null, 'int');
$user = ES::user($id);
$model = ES::model('Friends');

$options = array('state' => SOCIAL_FRIENDS_STATE_FRIENDS , 'limit' => 10);
$friends = $model->getFriends($user->id, $options);
[/gist]
where you can use the sql from the
.../administrator/components/com_easysocial/models/friends.php
@getFriends
·
Friday, 25 August 2017 11:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Fadhli,
Thank you very much.
In which file can I use this code?
Best regards.
Eric
·
Friday, 25 August 2017 14:46
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Eric,

You can use the code above in where you want to populate it, perhaps in the invitation popup?
\ Components \ com_easysocial \ themes \ wireframe \ groups \ dialogs \ invite.php
as if you want to make it in the dropdown (as per your 1st screenshot) there is some cons, if the user have a lots of friend,
the dropdown will be super long and hard to navigate
·
Friday, 25 August 2017 19:00
·
0 Likes
·
0 Votes
·
0 Comments
·
Fadhli,
What if I issue a CSS clas with an overflow?
·
Friday, 25 August 2017 20:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Yeah, I suppose if you add a overflow scroll bar, that would help
·
Friday, 25 August 2017 22:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,
Thank you very much.
I look at what this refers to, actually I find what I want.
I want to display the username and the avatar, I see well this information present when I make a print_r (friends).
Then I imagined using a "foreach" to display what I need, but I do not know what image I need to use to display the member's avatar.
Could you tell me ?


The loading time becomes quite long as soon as there is a certain amount of friends, would it be possible to limit the loading of the Username and the avatar?

Best regards.
Eric
·
Saturday, 26 August 2017 16:05
·
0 Likes
·
0 Votes
·
0 Comments
·
You can alter the limit in the options that is passed to the model,

[gist]
$options = array('state' => SOCIAL_FRIENDS_STATE_FRIENDS , 'limit' => 10);
[/gist]

You can set this to any other number. As for obtaining the avatar of a user, this is how you should do it in EasySocial,

[gist]
<?php
// $id is the user's id
$user = ES::user($id);
echo '<img src="' . $user->getAvatar() . '" />';
?>
[/gist]
·
Saturday, 26 August 2017 18:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,
In my loop I did:

Foreach ($ friends as $ element)
{
$ IDsUsers = $ element-> id;
Echo $ IDsUsers;
// echo '<img src = "'. $ IDsUsers-> getAvatar (). '" />';
Echo $ element-> username. '<br />';
}

To retrieve the avatar of users.
$ IDsUsers, returns the ID but when I use this variable to display the avatar it does not work anymore.
What is illogical?

Best regards.

Eric
·
Monday, 28 August 2017 16:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Eric,

Can you try the code below and see how it goes?
[gist type="php"]
foreach ($friends as $element) {
$iduser = $element->id;
echo $iduser;
$fid=ES::user($iduser);
echo '<img src="' . $fid->getAvatar() . '" />';
}
[/gist]
·
Monday, 28 August 2017 17:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you very much.
This allows me to advance on this point.
Best regards.
Eric
·
Monday, 28 August 2017 23:36
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Eric. Please do take note that support is not provided for customized codes and we are only offering help out of good faith.

Thank you for understanding!
·
Monday, 28 August 2017 23:54
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post