×

Error

Please login first

Custom Code action based upon connection type?

10 years 1 month ago #243854 by cpaschen
I need to create some custom actions (i.e. Auto Action | Code) when a connection is made (from a 'Team Leader' to a 'Team Member'). However, the 'Team Leader' will have several 'Teams'.

I'd like to use the connections and the Connection Type for organizing the structure. My functional need is similar to this post:

www.joomlapolis.com/forum/153-professional-member-support/221515-solved-auto-action-code-or-query-whats-wrong?limitstart=0

However, I need to have different code run based on the Connection Type that the 'Team Leader' chooses. (It doesn't matter what the 'Team Member' chooses for the connection type).

I've done some searching and I'm guessing that I could do the basics using the onAfterAccept Connection; however, I can't tell 2 things:

1. Is there any way to have a condition that checks the Connection Type?

and if so ...

2. Can I have to auto actions (one for each team) and have them BOTH fire if the 'Team Leader' selects 2 different Connection Types?


Using:
CB 1.9.1
Joomla 2.5.x

Please Log in to join the conversation.

10 years 1 month ago #243879 by krileon

1. Is there any way to have a condition that checks the Connection Type?

The onBeforeAcceptConnection trigger does not contain that information. It only contains the user id, connection id, mutual connections config setting, and auto accept connection config setting. Using a code action and PHP though you could call CB API and grab the connection request, but that still won't contain the details about type, etc.. you'd have to grab the connection of the person who sent it using getConnectionDetails function. Example as follows.

$cbCon = new cbConnection( '[user_id]' );
$connection = $cbCon->getConnectionDetails( '[var2]', '[user_id]' );

You won't be able to condition the action off this info, but an IF statement in your PHP could.

2. Can I have to auto actions (one for each team) and have them BOTH fire if the 'Team Leader' selects 2 different Connection Types?

Somewhat, as mentioned above that information isn't sent with the trigger. So you need to do all that checking in your PHP.


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 1 month ago #243912 by cpaschen
Replied by cpaschen on topic Custom Code action based upon connection type?
Is this something that might be possible within the new 2.x version of CB (Sorry, I've downloaded but not had the time to test).

If not, is there some documentation that can show me how to just create a tab on the user's profile where I can display custom code (i.e. create my own 'tab plugin' or 'custom CB plugin')?

Please Log in to join the conversation.

10 years 1 month ago #243916 by krileon

Is this something that might be possible within the new 2.x version of CB (Sorry, I've downloaded but not had the time to test).

In conditionals, no, but in your code it's doable now. No this won't change with CB 2.0 until the connections usage has been rewritten (planned for later 2.x release).

If not, is there some documentation that can show me how to just create a tab on the user's profile where I can display custom code (i.e. create my own 'tab plugin' or 'custom CB plugin')?

You need to create a custom CB plugin that renders its own tab. There used to be helloworld example plugins in the Free downloads section, but they're gone now (probably archived or moved) as they're too out of date. Best I can suggest is review existing plugins as examples. After CB 2.0 goes stable we'll be doing massive documentation improvements. For you now you can review the API documentation for in the free downloads section.


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.

Moderators: beatnantkrileon
Time to create page: 0.188 seconds

Facebook Twitter LinkedIn