New CB-Field-Groups with CB Auto Actions on Profile Tabs?

3 years 1 month ago - 3 years 1 month ago #306922 by SuperHaven
Hello everyone, I fired off an email to the contact us page to ask a question and was directed to post it here.

Me wrote: I got the email about the new CB Field Groups; I have a question about if something is possible; an automatic Find and Replace function.

I have a site that makes youtube videos about wood working, on the profiles users can list their tools by category, I want to have users add a tool to their list on the profile (through the new CB Field Groups), then I be able to search the list, then replace their text with an affiliate link to an amazon page. maybe a CB Auto Actions function?
Thanks and I hope to hear from you soon.

EmailReply wrote: Hi,Thanks for contacting us. Your question is interesting and its answer could certainly be useful to many other persons. But you have used the private contact form that is for any payment-related or private communication, and our department can't answer your technical question.
Please use our forums for any technical question, bug reports (except for security-related ones): [Removed info about what to post where to save you some reading]
Best Regards, Joomlapolis sales administration

Basically I am wanting to have tabs (each tab a category or type of tool) on the profiles where a user can post (text) of what tool they are using. I can then search the CBFGs and replace their text with a link to an amazon affiliate link.

What I would like better is if auto actions could do that for me. I have an idea of how to make that work but I do not know if the functionality is there (this will be my first time using auto actions) (waiting for payday to renew my professional membership) (If the functionality is not there, I would like to suggest this function).

I don't speak programmer so I hope I can explain this well enough:

Establish a "Type" of action called "Field Group Find and Replace": This would allow for a place where the admin can have a list of terms, and what to replace them with (that would be the parameters page on this type of action). An example based on the site I am putting together could be Term: DEWALT 12-in Miter Saw; Replace-Type: Link; Replace-with: [TEXT][LINK]

-On profile save (trigger)
--Check to see if text has been entered in the CB-Power-Tools-Field-Groups
-- --If No, do nothing (action complete)
-- --If Yes
-- -- --Compare input text to (Parameters list)
-- -- -- --If text matches replace with new term
-- -- -- --If text does not match
-- -- -- -- --Display input text on profile tab ; email admin: [USER] has added a product [INPUT-TEXT] to their [TAB-NAME] that is not in the database. Please update.; Admin adds the new information to the parameters page for the action, then opens the user's profile in the CB-backend and saves (retrigger).

Please Log in to join the conversation.

3 years 1 month ago #306947 by krileon
There is no search and replace in CB Field Groups and no plans for such functionality. You're needing live replacement and CB Auto Actions isn't really built for that. Best approach would probably be our CB Replacer Bot, which is a Joomla content prepare plugin for doing inline replacements like that (e.g. this would be the replacement list you're wanting). The problem is you can't directly execute Joomla content plugins on user supplied content for security purposes.

You've likely just two options for accomplishing this. First is creating a custom template for CB Field Groups and doing your replacements there directly before the field group is displayed, but you'll need experience with PHP to implement that. The second is to use the fields layout parameters and IF substitutions. Within the field under Parameters > Layout you could set Profile Value Layout to the below for example.

[cb:if FIELD_NAME="Saw"]
<a href="SAW_AFFILIATE_LINK_HERE">[value]</a>
[cb:elseif FIELD_NAME="Drill"]<a href="DRILL_AFFILIATE_LINK_HERE">[value]</a>[/cb:elseif]
[cb:elseif FIELD_NAME="Axe"]<a href="AXE_AFFILIATE_LINK_HERE">[value]</a>[/cb:elseif]

Be sure to replace FIELD_NAME with the actual name of the field. See the below substitution tutorial for further details.

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

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.157 seconds

Facebook Twitter LinkedIn