Integration with CB image-field and adsmanager field.

3 years 4 months ago #321589 by silverman1
I am using the extension Adsmanager together with CB.
With the adsmanager-plugin for CB, all fields made in CB will get "transferred" to a field in adsmanager. So if a user for example has put their name in a CB field, the name will automatically also show in that persons classified ads.

But this only works with text-based fields. How can I do this with an image-field. I want the image saved in CB also to show in the adsmanager field. Adsmanager has a field called "Custom code", where I can put the code I want. So I need the code that outputs the CB image field. What code do I need to use to retrieve the CB image field, so I can make the image also show in the adsmanager-field?

Best regards

Please Log in to join the conversation.

3 years 4 months ago #321591 by krileon
You would need to use the getFields API documented below.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18361-obtaining-field-values-through-getfields-api

If that Custom Code field supports Joomla content plugins then you can just use substitutions as shown below if CB Content Bot is installed.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb


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.

3 years 4 months ago #321840 by silverman1
According to the adsmanager developer their custom field doesn't work for this. I didn't get any more help from them.
So I'm trying to put the code directly in the "view" for this page. I know I have the user id on that page, here: $this->content->userid

So I tryed to use this code, but I'm a beginner with PHP so I only get syntax error.

public function getField ( $avatar, $defaultValue = null, $output = 'html', $formatting = 'none', $reason = 'profile', $list_compare_types = 0, $fullAccess = false, $fieldVariables = array() )

$avatar = $this->content->userid->getField( 'avatar', null, 'html', 'none', 'list' );

echo $avatar;

What did I do wrong?

Please Log in to join the conversation.

3 years 4 months ago #321882 by krileon
You need to establish a user object as instructed in the API tutorial. I do not suggest attempting to do this if you've no experience with PHP as we can not provide advanced help here in that regard since we do not provide coding assistance outside simple examples, which the tutorial already covers.


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.

3 years 4 months ago - 3 years 4 months ago #321909 by silverman1
Ok, I will try to find someone to help me with this.
In the documentation it says: "So you'll need to establish the $user of the logged in user.". But I don't want to display a field from the logged in user. I want to display a field from another user, the owner of the specific ad. So when a visitor looks at a ad, they see this users CB-image. I already have this user id in the same file ($userid = $this->content->userid;). Can I not use this user id?


And if I want to create a CB message button, so you can go to a users message page from a page outside of CB. Is that done the same way. Or is there any easier way to do this?

Please Log in to join the conversation.

3 years 4 months ago #321920 by krileon

But I don't want to display a field from the logged in user. I want to display a field from another user, the owner of the specific ad.

The tutorial covers this directly in the code examples. It even says "// Specific User".

I already have this user id in the same file ($userid = $this->content->userid;). Can I not use this user id?

Yes, you can use the user id, but you need to feed it to the API. You can't just call PHP functions on an integer which is the user id. Again, I do not suggest exploring advanced usages like this with no PHP experience.

And if I want to create a CB message button, so you can go to a users message page from a page outside of CB. Is that done the same way. Or is there any easier way to do this?

That'd just be a URL. Example as follows.

index.php?option=com_comprofiler&view=pluginclass&plugin=pms.mypmspro&action=message&func=new&to=USER_ID_HERE


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: silverman1

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.211 seconds

Facebook Twitter LinkedIn