By Charlie on Friday, 11 March 2022
Posted in Technical Issues
Likes 0
Views 448
Votes 0
Hello!



Is it possible to have the texts "Friends", "Add As Friend" and "Respond To Request" to be displayed without the button?

I would like to remove the button-functionality in this view, but not the texts.

See my attached file.



Charlie
You can try the following code in this file JoomlaFolder/components/com_easysocial/themes/wireframe/helpers/listing/user/card.php, these code use to determine the current logged in user friend with the user or not.


$friend = $user->getFriend($this->my->id);
$isFriends = $friend->state == SOCIAL_FRIENDS_STATE_FRIENDS;
$isPending = $friend->state == SOCIAL_FRIENDS_STATE_PENDING;

$friendStatus = 'Not a friend';

if ($isFriends) {
$friendStatus = 'Friend';
}
echo $friendStatus;
·
Monday, 14 March 2022 18:09
·
0 Likes
·
0 Votes
·
0 Comments
·
You can modify these files.

JoomlaFolder/components/com_easysocial/themes/wireframe/helpers/listing/user/card.php (user listing view)

JoomlaFolder/components/com_easysocial/themes/wireframe/helpers/user/user.friends.php (friend button, when you modify this file, other page friend button also will get effect too)
·
Friday, 11 March 2022 10:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello!



Is there any other way?

The thing I´m trying to accomplish is simply to display if a user is a friend or not, without the button displaying.

The button will display on every users Cover instead.

I´ve accomplished this same functionality for Groups, Pages och Events.

https://uboozt.se/index.php/sv/grupper = "Medlem"
https://uboozt.se/index.php/sv/kanaler = "Följare"
https://uboozt.se/index.php/sv/handelser-start = "Gäst"

I´ve used:
"<?php if ($group->canViewItem()) { ?>"
"<?php if ($page->canViewItem()) { ?>"
"<?php if ($event->canViewItem()) { ?>"

But when using "<?php if ($user->canViewItem()) { ?>" returns "Call to a member function canViewItem() on null".

Any quick tip what code I should use instead?



Charlie
·
Friday, 11 March 2022 18:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Do you mean that remove this "Add as friend" button then change it to the following label text?

1. If the user is already friends with the currently logged-in user, then display "unfriend" without a button?

2. If the user is not friends with the current logged-in user, then display "Add as friend" without a button?

But do you want the label text to allow the user to click it? Or do you only want to show the label text without showing a clickable link?
·
Monday, 14 March 2022 11:46
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello!



1. If a user is already a friend to the current logged in user, I want a text that says "Friend" to be displayed.
2. If a user is not a friend to the current logged in user, I want a text that says "Not a friend" to be displayed.
3. I don´t want any button or clickable link to be visible och clickable in this view (helpers/listing/user/card.php).

So what I´m asking for should be quite simple to achieve in (helpers/listing/user/card.php).

I want the button instead to be displayed in (helpers/cover/user.php) with normal functionality ("Friends", "Add As Friend" and "Respond to Request" as it is now.



Charlie
·
Monday, 14 March 2022 17:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello!



It´s working now!
Thank you for your help!



Charlie
·
Friday, 25 March 2022 16:56
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome.

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

Thanks for understanding.
·
Friday, 25 March 2022 17:13
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post