Friend request procedure

10 years 4 months ago #238618 by Ntelos
Friend request procedure was created by Ntelos
Hello there,

I have created a delimiter field. Inside this i use a Friend Request button. I also use a cb content module where i show this field like this:
[cb:if user="#displayed" user_id!="myid"][cb:userfield field="cb_friendrequest" user="#displayed" /][/cb:if]

So, if one user is not a friend of mine (and of course i am not in my profile), then this button is shown and i can click to send a friend request.

In this procedure i need to do this:

During the acceptance or the decline of the friend request, i can still see this button. So, i somehow need to know, how to control (hide/show) fields when the request is sent and before the user declines or accepts the request. So in this case i can show an image saying that the friend request has been sent.

The second thing to do is to control (show/hide) fields when one user is friend with another. So, i want to use a Remove from friends button and i need this button to be shown only when 2 users are friends.

Thank you in advance

Please Log in to join the conversation.

10 years 4 months ago #238620 by krileon
Replied by krileon on topic Friend request procedure
You need to create a CB Query field that queries the database to determine if the viewing user is connected or not. You can then use the query field in an IF substitution to conditionally display your buttons.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Ntelos

Please Log in to join the conversation.

10 years 4 months ago #238622 by Ntelos
Replied by Ntelos on topic Friend request procedure
Thank you very much! I will try this and come back with results or questions!

Please Log in to join the conversation.

10 years 4 months ago #238634 by Ntelos
Replied by Ntelos on topic Friend request procedure
So, i create a query field, i write a sql query where i select the user's connection field and then in the if conditional i say: if for example the value = 0, then show the Add friend button-field, if value = 1, to show the Pending request button-field and if value = 2 then show the Unfriend button-field.

I tried to find in phpmyadmin the table row where this value stored with no success. Can you indicate which sql row stores this information?

Please Log in to join the conversation.

10 years 4 months ago - 10 years 4 months ago #238647 by krileon
Replied by krileon on topic Friend request procedure
The below query should check if a user is connected or not.

SELECT COUNT(*) FROM `#__comprofiler_members` WHERE `referenceid` = '[cb:userdata field="user_id" user="#displayed" /]' AND `memberid` = '[cb:userdata field="user_id" user="#me" /]'

Next your substitution IF statement would check that the query field is greater than 0. If it is then there's a connection of some sort between the two users (it's not checking if it's pending or not).

Note none of this may really be needed with CB 2.0 as the Connection Path tab has been upgraded a lot and includes buttons to connect now.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

10 years 4 months ago #238695 by Ntelos
Replied by Ntelos on topic Friend request procedure
I saw that a beta version was published. Do you know an estimated date or month that a stable version of CB 2.0 will be published for live site usage?

Till then, isn't there a way to know if a connection is pending (control the connection between the add connection and acceptance/decline connection)?

Thank you in advance

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.373 seconds

Facebook Twitter LinkedIn