Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] Connect button on user list

11 years 8 months ago - 11 years 8 months ago #221436 by ClaraPerry
[SOLVED] Connect button on user list was created by ClaraPerry
Hi

This is a continuation from a previous post about adding a connection and remove connection button to the user list page, which only show depending on whether a connection has been made.

The previous posts can be found here: www.joomlapolis.com/forum/146-general/219309-purchasing-if-i-can-achieve-connect-button-on-user-list?start=6

I have installed CB Pro and CB Query Field.

Update:
.........................................................................................

Ok I have figured out I need to put the code below in the CB Query Field called cb_checkconn.
Code:
SELECT COUNT(*) FROM `#__comprofiler_members` WHERE `referenceid` = '[cb:userdata field="user_id" user="#me" /]' AND `memberid` = '[user_id]'

I then used the code below in a Delimiter Field to output the buttons.
Code:
[cb:if cb_checkconn>"0"] [menu style="color:black;" caption="Remove Connection" img=""] _UE_MENU_CONNECTIONS : _UE_REVOKECONNECTIONREQUEST [/menu] [/cb:if] [cb:if cb_checkconn="0"] [menu style="color:black;" caption="Add Connection" img=""] _UE_MENU_CONNECTIONS : _UE_ADDCONNECTIONREQUEST [/menu] [/cb:if]

This works in the profiles perfectly but in the user list the links don't show. What am I doing wrong here. Is there some header code required in the user list to show menu items? Or should I be outputting the connect and remove links differently?
Last edit: 11 years 8 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48475
  • Thanks: 8281
  • Karma: 1443
11 years 8 months ago - 11 years 8 months ago #221484 by krileon
Replied by krileon on topic Connect button on user list
Display the query field on userlist and see what the output is. Compare it to what you see on profile. Substitutions behave differently based off location.


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.
Last edit: 11 years 8 months ago by krileon.

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

11 years 8 months ago - 11 years 8 months ago #221510 by ClaraPerry
Replied by ClaraPerry on topic Connect button on user list
Thanks for the reply.

I put the query field in the user list which outputs 0 for non connected user and 1 for connected user.

So this shows the query is functing correctly.

However the delimiter field which outputs the button shows nothing. If I change the delimiter field to the code below, then ADD CONNECTION is shown when the user is not connected and REMOVE CONNECTION is shown when a user is connected. This is how it should work.
Code:
[cb:if cb_checkconn>"0"] REMOVED CONNECTION [/cb:if] [cb:if cb_checkconn="0"] ADD CONNECTION [/cb:if]

So the issue is that the code below doesn't work on the user list page, probabaly because menus are not supported on the user list page. How can I get around this?
Code:
[menu caption="Remove Connection"] _UE_MENU_CONNECTIONS : _UE_REMOVECONNECTION [/menu] [menu caption="Add Connection"] _UE_MENU_CONNECTIONS : _UE_ADDCONNECTIONREQUEST [/menu]
Last edit: 11 years 8 months ago by ClaraPerry.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48475
  • Thanks: 8281
  • Karma: 1443
11 years 8 months ago - 11 years 8 months ago #221519 by krileon
Replied by krileon on topic Connect button on user list
You would need to build them using HTML instead of the menu substitution, which doesn't work on userslists. Below is example of add/remove links with HTML.

Add Connection:
<a href="index.php?option=com_comprofiler&act=connections&task=addConnection&connectionid=[user_id]">Add Connection</a>

Remove Connection:
<a href="index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=[user_id]">Remove Connection</a>


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.
Last edit: 11 years 8 months ago by krileon.

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

11 years 8 months ago #221617 by ClaraPerry
Replied by ClaraPerry on topic Connect button on user list
Thank you it worked perfectly. I also added an extra substitution if statement so the connect button doesn't show on the users own profile (see below).
Code:
[cb:if user_id!="myid"][cb:if cb_checkconn>"0"]<a href="index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=[user_id]">Remove Connection</a>[/cb:if] [cb:if cb_checkconn="0"]<a href="index.php?option=com_comprofiler&act=connections&task=addConnection&connectionid=[user_id]">Add Connection</a>[/cb:if][/cb:if]

One final question. When I click on the add connection button on the user list it then takes me to that persons profile. Would there be a way to make it so it stayed in the user list page?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48475
  • Thanks: 8281
  • Karma: 1443
11 years 8 months ago #221678 by krileon
Replied by krileon on topic Connect button on user list

Would there be a way to make it so it stayed in the user list page?

Nope, the add connection function redirects to profile page.


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