Skip to Content Skip to Menu

[SOLVED] fan instead of connections

10 years 9 months ago #239663 by thewebsurfer
Replied by thewebsurfer on topic fan instead of connections

krileon wrote: The connection request endpoints are within the below file.

/components/com_comprofiler/comprofiler.php

Review addConnection, removeConnection, denyConnection, and acceptConnection. Sorry, I can not advise you on core edits so you are on your own in regards to modifying these.


i checked comprofiler.php, but i cant find in those function the DB query for the connection..

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 9 months ago #239668 by krileon
Replied by krileon on topic fan instead of connections
That's because there is an API call to do it. You don't need to do a DB query. For example see the below usage.

Code:
$cbCon = new cbConnection( $userid ); if ( ! $cbCon->addConnection( $connectionid, stripcslashes( $umsg ) ) ) {

In the above example you'd swap $userid and $connectionid to reverse the connection direction.


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 or Create an account to join the conversation.

10 years 9 months ago - 10 years 9 months ago #239671 by thewebsurfer
Replied by thewebsurfer on topic fan instead of connections
ok editing addConnection the button "like!" works as i want.
just another thing:
after i click the button
[menu caption="like!"] _UE_MENU_CONNECTIONS : _UE_ADDCONNECTION[/menu]
in the profile page of the user i still can see this button, instead of a remove connection button
[menu caption="not like" img="" class="btn"] _UE_MENU_CONNECTIONS : _UE_REMOVECONNECTION[/menu]

(obiouvsly i have a field with both buttons)

can CB detect the connection and change the button?
Last edit: 10 years 9 months ago by thewebsurfer.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 9 months ago #239701 by krileon
Replied by krileon on topic fan instead of connections

can CB detect the connection and change the button?

No, you'd need to use CB Query Field to query the database and see if a connection exists. Now you'll need to add a substitution IF statement to condition the button. Pretty sure someone has already done this usage though, please search.


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 or Create an account to join the conversation.

10 years 9 months ago - 10 years 9 months ago #239708 by thewebsurfer
Replied by thewebsurfer on topic fan instead of connections

krileon wrote:

can CB detect the connection and change the button?

Now you'll need to add a substitution IF statement to condition the button. Pretty sure someone has already done this usage though, please search.


do you mean without a using a query?
if so, how can i use an IF like this [cb:if user_id="myid"]
those works just for #__comprofiler table, right?

it would much easier if CB allows php code in their field..

another little thing: could you tell me how to edit deny connection for my use case:
Code:
$cbCon = new cbConnection( $userid ); $cbCon->denyConnection( $userid, $connectionid );
i tried to switch userid and connectionid, but in this case doesnt work..
Last edit: 10 years 9 months ago by thewebsurfer.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 9 months ago #239718 by krileon
Replied by krileon on topic fan instead of connections
There's no way to know if two users are connected or not without using CB Query Field to query the database.

it would much easier if CB allows php code in their field..

I'll be developing a CB Code Field plugin after release of CB 2.0, so it's planned.


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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum