Willkommen, Gast
Angemeldet bleiben:

THEMA:

Validation Check in custom user registration form 8 Jahre 5 Monate her #93231

  • pratam02s Avatar Autor
  • pratam02
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Beiträge: 182
  • Dank erhalten: 3
Hi Team,

We have designed custom user registration form in BF and it works great.

We want to check the existence of the e-mail ID entered by user with our database before submitting the form..
Please help us achieve it.......
Thanks & Regards
Praveen
Bangalore
India

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Re: Validation Check in custom user registration form 8 Jahre 5 Monate her #93347

  • lennerd
  • Offline
  • Developer
  • Developer
  • Beiträge: 4669
  • Karma: 72
  • Dank erhalten: 411
Hello,

which Joomla version do you use and could you provide the code you are using?


In general you should use the API functions to register a new user, in this case the validation of an email address would be done automatically.
Regards,
Stefan

===============================================
Satisfied? Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Re: Validation Check in custom user registration form 8 Jahre 5 Monate her #93443

  • pratam02s Avatar Autor
  • pratam02
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Beiträge: 182
  • Dank erhalten: 3
Hello lennerd,

thanks for your response.

I am unable to understand API functions, can you explain it please (you mean to say joomla built in user registration module??)

i am using joomla 2.5.9 version and i am using BF 1.7.5 free version

we are not using joomla user registration module due to some different requirement.

hence, we designed same kind of form from BF and we are able add new user to user table and it is working fine.

now the requirement is: we just want to check the email entered by user before submitting it.

many thanks in advance
Thanks & Regards
Praveen
Bangalore
India

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Re: Validation Check in custom user registration form 8 Jahre 5 Monate her #93574

  • lennerd
  • Offline
  • Developer
  • Developer
  • Beiträge: 4669
  • Karma: 72
  • Dank erhalten: 411
Hello,

please see the following code which handels user registration in Joomla 2.5.x and 3.0 (it is different from 1.5)

$the_name_field = ff_getSubmit('name');
$the_email_field = ff_getSubmit('email');
$the_password_field = ff_getSubmit('password');
$the_username_field = ff_getSubmit('username');
JFactory::getLanguage()->load('com_users', JPATH_SITE);

$config = JFactory::getConfig();
$params = JComponentHelper::getParams('com_users');

// Initialise the table with JUser.
$user = new JUser;
$data = array();
$data = '';
$data = 0;

// Prepare the data for the user object.
$data = $the_email_field;
$data = $the_password_field;
$data = $the_password_field;
$data = $the_name_field;
$data = $the_username_field;
$data = array($params->get('new_usertype'));
$useractivation = $params->get('useractivation');

// Check if the user needs to activate their account.
if (($useractivation == 1) || ($useractivation == 2)) {
jimport('joomla.user.helper');
$data =JApplication::getHash(JUserHelper::genRandomPassword());
$data = 1;
}

// Bind the data.
if (!$user->bind($data)) {
// $this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
echo '<script>alert("' . addslashes(JText::_($user->getError())) . '");history.go(-1);</script>';
exit;
}

// Load the users plugin group.
JPluginHelper::importPlugin('user');

// Store the data.
if (!$user->save()) {
// $this->setError(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
echo '<script>alert("' . addslashes(JText::_($user->getError())) . '");history.go(-1);</script>';
exit;
}

// Compile the notification mail values.
$data = $user->getProperties();

$data = $config->get('fromname');
$data = $config->get('mailfrom');
$data = $config->get('sitename');
$data = JUri::base();

// Handle account activation/confirmation emails.
if ($useractivation == 2) {
// Set the link to confirm the user email.
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data, false);

$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS', $data, $data
);

$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data, $data, $data . 'index.php?option=com_users&task=registration.activate&token=' . $data, $data, $data, $data
);
} else if ($useractivation == 1) {
// Set the link to activate the user account.
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data, false);

$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS', $data, $data
);

$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data, $data, $data . 'index.php?option=com_users&task=registration.activate&token=' . $data, $data, $data, $data
);
} else {

$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS', $data, $data
);

$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_BODY', $data, $data, $data
);
}

// Send the registration email.
$this->sendMail($data, $data, $data, $emailSubject, $emailBody);

}

Please see the following section in the code above:

// Bind the data.
if (!$user->bind($data)) {
// $this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
echo '<script>alert("' . addslashes(JText::_($user->getError())) . '");history.go(-1);</script>';
exit;
}

// Load the users plugin group.
JPluginHelper::importPlugin('user');

// Store the data.
if (!$user->save()) {
// $this->setError(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
echo '<script>alert("' . addslashes(JText::_($user->getError())) . '");history.go(-1);</script>';
exit;
}

This is how to validate username and email in the registration process using the api functions.
Regards,
Stefan

===============================================
Satisfied? Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================
Folgende Benutzer bedankten sich: pratam02

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Re: Validation Check in custom user registration form 8 Jahre 4 Monate her #94493

  • chencho
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Beiträge: 4
  • Dank erhalten: 0
Hi!

I have a similar issue... but more simple. it's possible check if the email is registered into a normal form?

---

Solved:
crosstec.org/en/forums/41-breezingforms-...-database.html#88599

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Letzte Änderung: Post by chencho.
  • Seite:
  • 1
Moderatoren: ForumSupport
Ladezeit der Seite: 0.054 Sekunden

Angebot

Sommer Special! Alle Mitgliedschaften zum Sonderpreis!

Prio Support, alle Extensions und alle Templates in einem Paket.

Hier geht's zur Bestellung

Crosstec hilft sparen!

Falls Sie neu bei Crosstec sind aber bereits einen Formulargenerator bei einem anderen Hersteller gekauft haben, dann bekommen sie von uns einen Rabatt von 25% auf unsere 1-Jahres und Pro-Mitgliedschaften

Wie Sie an den Rabatt kommen?

Schreiben Sie uns einfach eine kurze Email mit beigelegten Kaufbeleg (z.B. PayPal Quittung) an sales@crosstec.org.

Wir unterstützen die Joomla Community

Crosstec unterstützt weltweit alle offiziellen Joomla! User Groups und Organisatoren von Joomla! Days die bei Joomla.org registriert sind.

Falls das auf dich zutrifft und du eines unserer Produkte brauchst, schreib uns eine kurze Email an info@crosstec.org und du bekommst eine Flatrate-Mitgliedschaft geschenkt!