Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] Preventing user registration based on external API call

  • softforge
  • softforge
  • OFFLINE
  • Posts: 129
  • Thanks: 21
  • Karma: 12
9 years 9 months ago - 9 years 9 months ago #259704 by softforge
I have a situation where one of the fields that a user submits needs to be checked with an external web service and the result should determine whether the registration is successful.

So, I have setup CB Auto Actions using the onBeforeUserRegistration trigger to run some custom PHP code which does the web services call to see if the user has provided valid data. This is working fine but I cant work out how to prevent the registration from going through if the user provides invalid data. Is it possible to stop a registration from being successful using custom code in CB Auto Actions?

Alternatively, is there a way to run custom PHP code as a validation rule against a specific field?

Many thanks.

If you like our plugins, please consider writing a review on the Joomla Extension Directory or the Community Builder Directory ...
Last edit: 9 years 9 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
9 years 9 months ago - 9 years 9 months ago #259754 by krileon
You need to set a global plugin error to stop it from CB Auto Actions. The below might work, but I have not tested such a scenario. Ideally you'd develop a plugin that adds new validation to fields like CB Query Field does with its query validation.

Code:
global $_PLUGINS; $_PLUGINS->_setErrorMSG( 'Your registration failed!' ); $_PLUGINS->raiseError();

The above is basically how CB AntiSpam does it to stop blocked login/registration attempts.

Alternatively, is there a way to run custom PHP code as a validation rule against a specific field?

No, not yet, but a planned future plugin CB Code Field will provide this (it'll be like CB Query Field except with PHP).


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

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

  • softforge
  • softforge
  • OFFLINE
  • Posts: 129
  • Thanks: 21
  • Karma: 12
9 years 9 months ago #260451 by softforge
I just wanted to say that this works perfectly, thanks Kyle! :cheer:

If you like our plugins, please consider writing a review on the Joomla Extension Directory or the Community Builder Directory ...

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

Moderators: beatnantkrileon
Powered by Kunena Forum