Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] How to display a field value for a connection

13 years 8 months ago - 13 years 8 months ago #158852 by aaron@servicefly.com
[SOLVED] How to display a field value for a connection was created by aaron@servicefly.com
1st, I am a paid user (paid for documentation).
2nd, I searched everywhere I found for the answer before posting:

Once a connection is accepted and a profile owner now sees a connection box with their avatar showing; how can I get a field value to show from the connections profile?

I looked at inserting into cb.connections.php a value like:

$connection->cb_fieldname

Not working...

$user->cb_fieldname

works fine.

It is probably a simple mistake but I am now baffled. Thanks for any help.
Last edit: 13 years 8 months ago by krileon.

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
13 years 8 months ago - 13 years 8 months ago #158860 by nant

aaron@servicefly.com wrote: 1st, I am a paid user (paid for documentation).


You were - thank you - FYI your subscription ended in february.

2nd, I searched everywhere I found for the answer before posting:

Once a connection is accepted and a profile owner now sees a connection box with their avatar showing; how can I get a field value to show from the connections profile?

I looked at inserting into cb.connections.php a value like:

$connection->cb_fieldname

Not working...

$user->cb_fieldname

works fine.

It is probably a simple mistake but I am now baffled. Thanks for any help.


You cannot without modifying code. The connection box is just meant as a quick link back to connected profile so you can see the value at its source.

I guess you would need to load the connected user object - maybe krileon can follow-up on this later...
Last edit: 13 years 8 months ago by nant.

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

13 years 8 months ago #158889 by aaron@servicefly.com
Replied by aaron@servicefly.com on topic Re: How to display a field value for a connection
Thanks for the quick reply Nant. My apologies, I honestly had not realized my subscription was up. I look forward to becoming a Professional subscriber when CB 2.0 comes out (I hope it's soon:).

To add a little more detail, I just want the connection's city to be displayed in the connection box or a text field with similar data.

Thanks guys...

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

13 years 8 months ago - 13 years 8 months ago #159221 by aaron@servicefly.com
Replied by aaron@servicefly.com on topic Re: How to display a field value for a connection
I am now further baffled! I have used everything I could to retrieve the value:

$_CB_database->setQuery ()

and

cb:userdatafield, blah, blah, blah

I even tried to add variables to cb_core to reference.

I know the following variables are connected to $connection:

name
username
email
primaryemailaddress
image
pm

etc...

and it seems they are related to field types??

Before this; I thought I was a decent PHP guy o_O

Oh, I forgot to mention I have been all through Krileon's tutorials.
Last edit: 13 years 8 months ago by aaron@servicefly.com.

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

13 years 8 months ago #159570 by aaron@servicefly.com
Replied by aaron@servicefly.com on topic Re: How to display a field value for a connection
Can you guys bump this up to the Professional forum? I purchased it in hopes I could get this answered. Thanks.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8302
  • Karma: 1446
13 years 8 months ago #159824 by krileon
You would need to make the below edit to add additional content in the form of a CB user object.

IN: components/com_comprofiler/plugin/user/plug_cbconnections/
ON: Line 258
FROM:
Code:
$conAvatar = getFieldValue( 'image', $connection->avatar, $connection );
TO:
Code:
$conn_user =& CBuser::getUserDataInstance( (int) $connection->memberid ); $conAvatar = getFieldValue( 'image', $connection->avatar, $connection );

Once done you can now use $conn_user->cb_fieldname to add field values anywhere you want. The reason you can't use $connection is because it's just a custom database object and is not a CB user object.

Please understand we do not support core edits, professional subscriber or not, as it risks the integrity of your site and you WILL lose the edits when upgrading. Against better judgement the above was provided anyway, please use at ones own risk.


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