Difference between revisions of "JTableUser/check"
From Joomla! Documentation
< API15:JTableUser
(New page: ===Description===
Validation and filtering
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</sp...) |
m (removing red link to edit, no existant pages) |
||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 86: | Line 86: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 101: | Line 101: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Revision as of 13:54, 12 May 2013
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Validation and filtering
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
check()
Returns[edit]
boolean True is satisfactory
Defined in[edit]
libraries/joomla/database/table/user.php
Importing[edit]
jimport( 'joomla.database.table.user' );
Source Body[edit]
function check()
{
jimport('joomla.mail.helper');
// Validate user information
if (trim( $this->name ) == '') {
$this->setError( JText::_( 'Please enter your name.' ) );
return false;
}
if (trim( $this->username ) == '') {
$this->setError( JText::_( 'Please enter a user name.') );
return false;
}
if (preg_match( "#[<>\"'%;()&]#i", $this->username) || strlen(utf8_decode($this->username )) < 2) {
$this->setError( JText::sprintf( 'VALID_AZ09', JText::_( 'Username' ), 2 ) );
return false;
}
if ((trim($this->email) == "") || ! JMailHelper::isEmailAddress($this->email) ) {
$this->setError( JText::_( 'WARNREG_MAIL' ) );
return false;
}
if ($this->registerDate == null) {
// Set the registration timestamp
$now =& JFactory::getDate();
$this->registerDate = $now->toMySQL();
}
// check for existing username
$query = 'SELECT id'
. ' FROM #__users '
. ' WHERE username = ' . $this->_db->Quote($this->username)
. ' AND id != '. (int) $this->id;
;
$this->_db->setQuery( $query );
$xid = intval( $this->_db->loadResult() );
if ($xid && $xid != intval( $this->id )) {
$this->setError( JText::_('WARNREG_INUSE'));
return false;
}
// check for existing email
$query = 'SELECT id'
. ' FROM #__users '
. ' WHERE email = '. $this->_db->Quote($this->email)
. ' AND id != '. (int) $this->id
;
$this->_db->setQuery( $query );
$xid = intval( $this->_db->loadResult() );
if ($xid && $xid != intval( $this->id )) {
$this->setError( JText::_( 'WARNREG_EMAIL_INUSE' ) );
return false;
}
return true;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />