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] Auto Actions - Registration (modify field before saving)

  • xengent
  • xengent
  • OFFLINE
  • Posts: 54
  • Thanks: 2
  • Karma: 0
8 years 7 months ago - 8 years 7 months ago #278726 by xengent
I'm using the "get_field" method to register users via auto actions as mentioned here:

www.joomlapolis.com/forum/153-professional-member-support/231927-solved-rest-api-style-cb-user-registration-direct-url-using-auto-actions

I'm placing [get_email] in the email field and passing the email as a variable. The problem is I need to be able to add a "+something" before the @ sign within that email field.

For example, if the email variable being passed is john@domain.com , I need to be able to save it as john+something@domain.com . Is there a way to do this?

I don't mind creating another action after the registration is complete and changing that field. I noticed there is a "multiply, divide, add, subtract" operators under the "Field" type action.
Last edit: 8 years 7 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #278762 by krileon
Yes, but wouldn't it just be massively easier to simply pass john+something@domain.com to begin with. You'll have to use a combination of format functions that you'll need to enable under the Parameters tab. Specifically extract, position, etc.. to split the string apart.


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.

  • xengent
  • xengent
  • OFFLINE
  • Posts: 54
  • Thanks: 2
  • Karma: 0
8 years 7 months ago #278784 by xengent
Yes that would be easier, however it is being passed in tact as a variable from another CRM. And since I can't break it up on their end, I have to break it up on my end.

Any examples I can look at to do this?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago - 8 years 7 months ago #278792 by krileon

Any examples I can look at to do this?

You're basically using substr and strpos via the extract (substr) and position (strpos) format functions. The below might work. Below might work, but I didn't test it.

Code:
[cb:parse function="extract" start="0" length="[cb:parse function="position" search="@"][get_email][/cb:parse]"][get_email][/cb:parse]+NEW_STRING_HERE[cb:parse function="extract" start="[cb:parse function="position" search="@"][get_email][/cb:parse]"][get_email][/cb:parse]


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

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

  • xengent
  • xengent
  • OFFLINE
  • Posts: 54
  • Thanks: 2
  • Karma: 0
8 years 7 months ago #278804 by xengent
Can I get a step by step on this? I tried a few things but it's not working for me.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #278844 by krileon
First you need to grab the position of @ as you would with PHP strpos to see where it's at in the string. This is done as follows.

[cb:parse function="position" search="@"][get_email][/cb:parse]

Next you need to grab the string beginning at @ and onwards so you can insert before it. This is done by passing the result of the above to

[cb:parse function="extract" start="POSITION_HERE"][get_email][/cb:parse]

That gives you "@domain.com". Now you need the beginning of the email address. This is done by grabbing the string from 0 (beginning of the string) to the @ using the length parameter as follows.

[cb:parse function="extract" start="0" length="POSITION_HERE"][get_email][/cb:parse]

That gives you "john". Now you'd combine the 2 usages to add whatever you want between them as follows.

START+testEND

The usage in my above reply does exactly this, but it's not going to do anything unless you've turned on Format Functions under the Parameters tab of your auto action as by default format functions only work for conditions.


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

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

Moderators: beatnantkrileon
Powered by Kunena Forum