Buy Now
Sign in

FAQ search

How can I add CB Registration in CFV5?

Details
Published: Monday, 03 November 2014 15:19

The built-in Community Builder (CB) Registration that existed in Cfv4 is not yet included in CFv5. User Rafifi suggested the following code as a way to add new users to CB. The code needs to go after the Joomla! Registration action.

<?php
$user = JFactory::getUser();
$form->data['id'] = $user->id;
$db = JFactory::getDBO();
$query = "
INSERT INTO `#__comprofiler` (`id`, `user_id`)
  VALUES ('{$user->id}', '{$user->id}') ;
";
$db->setQuery($query);
if ( !$db->query() ) {
  JError::raiseWarning(100, $database->getErrorMsg());
}
?>