english/libraries/joomla/user/helper.php
/**
	 * Method to activate a user
	 *
	 * @param   string  $activation  Activation string
	 *
	 * @return  boolean  True on success
	 *
	 * @since   11.1
	 */
Method to activate a user
@param   string  $activation  Activation string

@return  boolean  True on success


Method to activate a user @param string $activation Activation string @return boolean True on success
public static function activateUser($activation)
	{
		$db = JFactory::getDbo();
		$query = 'SELECT id'
		. ' FROM #__users'
		. ' WHERE activation = '.$db->Quote($activation)
		. ' AND block = 1'
		. ' AND lastvisitDate = '.$db->Quote('0000-00-00 00:00:00');
		;
		$db->setQuery($query);
		$id = intval($db->loadResult());
				if ($id)
		{
			$user = JUser::getInstance((int) $id);
			$user->set('block', '0');
			$user->set('activation', '');
			if (!$user->save())
			{
				JError::raiseWarning("SOME_ERROR_CODE", $user->getError());
				return false;
			}
		}
		else
		{
			JError::raiseWarning("SOME_ERROR_CODE", JText::_('JLIB_USER_ERROR_UNABLE_TO_FIND_USER'));
			return false;
		}
		return true;
	}
public static function activateUser ( $ activation ) { $ db = JFactory :: getDbo ( ) ; $ query = 'SELECT id' . ' FROM #__users' . ' WHERE activation = ' . $ db -> Quote ( $ activation ) . ' AND block = 1' . ' AND lastvisitDate = ' . $ db -> Quote ( '0000-00-00 00:00:00' ) ; ; $ db -> setQuery ( $ query ) ; $ id = intval ( $ db -> loadResult ( ) ) ; if ( $ id ) { $ user = JUser :: getInstance ( ( int ) $ id ) ; $ user -> set ( 'block' , '0' ) ; $ user -> set ( 'activation' , '' ) ; if ( ! $ user -> save ( ) ) { JError :: raiseWarning ( " SOME_ERROR_CODE " , $ user -> getError ( ) ) ; return false ; } } else { JError :: raiseWarning ( " SOME_ERROR_CODE " , JText :: _ ( 'JLIB_USER_ERROR_UNABLE_TO_FIND_USER' ) ) ; return false ; } return true ; }
Method to activate a user
 @param   string  $activation  Activation string
Method to activate a user @param string $activation Activation string
// Initialize some variables. // Let's get the id of the user we want to activate // Is it a valid user to activate?
 // Time to take care of business.... store the user.