Synchronizing Joomla and Community builder users will solve many Community Builder user related issues such as; Synchronizing users between Community Builder and Virtuemart, Synchronizing users and external authentications such as Gmail, twitter and much much more.
I think this will work for any version of Joomla or Community Builder - Tested on Joomla 1.5 and CB 1.2
######## Solution 1: (Just cron job) ########
Example:
DB Username: username
DB Password: password
Database name: database
Host: cmysql5-1.host.com
Port: 3306
NB: change jos_ if you are using an alternative prefix e.g. joom_
Note: The info below goes into your “Command” line, you need to configure how often you want to run the cron job in the cron job settings while scheduling/setting up the cron job. For more info on setting up your cron job please contact your website host or go to our support forum: http://gxi.co.za/webmaster-forum.html
// SIMPLE:
Use this if your sql host is “localhost” (default in most cases)
mysql -uusername -ppassword database -e "INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users";
e.g (will run every hour):
* */1 * * * mysql -uusername -ppassword database -e "INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users";
// ADVANCED:
Use this if your sql host is not “localhost” and you need to enter a host address and port (cmysql5-1.host.com: 3306 etc)
mysql -uusername -ppassword -hcmysql5-1.host.com -P3306 database -e "INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users";
e.g (will run every hour):
* */1 * * * mysql -uusername -ppassword -hcmysql5-1.host.com -P3306 database -e "INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users";
--------------------------------------------------------------------------
######## Solution 2: (Cron job + File) ########
Create a PHP file somewhere with the following information (be sure to correct to your database settings), when you setup you crone job ensure you include the full path i.e.
* */1 * * * php /full/path/to/script.php
The PHP file must contain:
<?php
$server = 'localhost';
$username = 'mysql_username';
$password = 'mysql_password';
$database = 'mysql_database_name';
### connects to the database, or dies with error
$connection = mysql_connect($server,$username,$password);
if (!$connection)
{
die( mysql_error() );
}
### selects the db of choice, or dies with error
$db_selection = mysql_select_db($database, $connection);
if (!$db_selection)
{
die( mysql_error() );
}
### selects all tables in the db of choice, or dies with error
$alltables = mysql_query("SHOW TABLES") or die ( mysql_error() );
### loops through all of the tables and optimizes each, or dies with error
while ( $table = mysql_fetch_array($alltables) )
{
mysql_query("INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users") or die( mysql_error() );
}
### closes the mysql connection
mysql_close($connection);
?>
[Solved] Auto Sync Users Community Builder and Joomla - NEW
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
-
- Joomla! Fledgling
- Posts: 3
- Joined: Fri Sep 11, 2009 5:35 pm
[Solved] Auto Sync Users Community Builder and Joomla - NEW
Last edited by pe7er on Fri Sep 11, 2009 7:53 pm, edited 1 time in total.
Reason: Self promotion is not allowed. Manual signature has been removed. Please use the forum signature (see profile) instead.
Reason: Self promotion is not allowed. Manual signature has been removed. Please use the forum signature (see profile) instead.
For more information - GXI Solutions & Development: http://www.gxi.co.za
-
- Joomla! Fledgling
- Posts: 2
- Joined: Mon May 17, 2010 11:44 pm
Re: [Solved] Auto Sync Users Community Builder and Joomla -
I really needed to force the Community Builder syncUsers to execute at the end of the Virtuemart order process - so users can buy something in the shop, leave the site and find they can log in. Before I implemented the hack below, I was finding that users were not able to log into the site because their Community Builder "Confirmed" and "Approved" status was set to NO.
I didn't want my users to have to respond to an email to complete their Virtuemart purchase, so I couldn't stick the syncUsers on the authorisation process, as suggested elsewhere.
I read about a module that would do this job, but I didn't want to slow the site down by executing syncUsers more than possible. So I stuck it on the end of the Virtuemart order process.
The file I edited was administrator/components/com_virtuemart/html/checkout.thankyou.php
I just added the code below before the final ?> (which I left in the code snippet so you can see where the hack sits relative to the final ?> )
Hope this helps someone - I have been struggling with it all day and am grateful to all who wrote related information that made this fix possible for me. I have tested it and the syncUsers is happening at the end of a VM pruchase, as hoped for. Yay!
I didn't want my users to have to respond to an email to complete their Virtuemart purchase, so I couldn't stick the syncUsers on the authorisation process, as suggested elsewhere.
I read about a module that would do this job, but I didn't want to slow the site down by executing syncUsers more than possible. So I stuck it on the end of the Virtuemart order process.
The file I edited was administrator/components/com_virtuemart/html/checkout.thankyou.php
I just added the code below before the final ?> (which I left in the code snippet so you can see where the hack sits relative to the final ?> )
Code: Select all
// A hack to force Community Builder to syncUsers and set confirmed and approved to true
$sql_sync = "INSERT IGNORE INTO #__comprofiler(id,user_id) SELECT id,id FROM #__users";
$database->setQuery($sql_sync);
$database->query();
?>
-
- Joomla! Fledgling
- Posts: 1
- Joined: Fri Jan 07, 2011 12:26 am
Re: [Solved] Auto Sync Users Community Builder and Joomla -
Awesome that did help, do you know which file I'd have to append that code to, to make it sync on the registration complete part of the checkout process instead.
-
- Joomla! Apprentice
- Posts: 11
- Joined: Fri Sep 05, 2008 10:56 am
Re: [Solved] Auto Sync Users Community Builder and Joomla -
Artificia3 wrote:I really needed to force the Community Builder syncUsers to execute at the end of the Virtuemart order process - so users can buy something in the shop, leave the site and find they can log in. Before I implemented the hack below, I was finding that users were not able to log into the site because their Community Builder "Confirmed" and "Approved" status was set to NO.
I didn't want my users to have to respond to an email to complete their Virtuemart purchase, so I couldn't stick the syncUsers on the authorisation process, as suggested elsewhere.
I read about a module that would do this job, but I didn't want to slow the site down by executing syncUsers more than possible. So I stuck it on the end of the Virtuemart order process.
The file I edited was administrator/components/com_virtuemart/html/checkout.thankyou.php
I just added the code below before the final ?> (which I left in the code snippet so you can see where the hack sits relative to the final ?> )
Hope this helps someone - I have been struggling with it all day and am grateful to all who wrote related information that made this fix possible for me. I have tested it and the syncUsers is happening at the end of a VM pruchase, as hoped for. Yay!Code: Select all
// A hack to force Community Builder to syncUsers and set confirmed and approved to true $sql_sync = "INSERT IGNORE INTO #__comprofiler(id,user_id) SELECT id,id FROM #__users"; $database->setQuery($sql_sync); $database->query(); ?>
I am not using VM but I want to use the default joomla login...
where do I need to add this code to get it to sync users on each login request?
using joomla 1.5.22
please advice.
Thanks
hk
- xamonix
- Joomla! Apprentice
- Posts: 24
- Joined: Tue Oct 17, 2006 3:41 am
Re: [Solved] Auto Sync Users Community Builder and Joomla -
To sync Communit Builder with joomla just put this code at the end of the registration file (com_user/register).
That would do the job.
That would do the job.
-
- Joomla! Fledgling
- Posts: 1
- Joined: Tue Aug 09, 2016 9:45 pm
Re: [Solved] Auto Sync Users Community Builder and Joomla - NEW
Working perfectly for me in Joomla 3.6.x+
Thanks.
Thanks.
-
- Joomla! Fledgling
- Posts: 1
- Joined: Wed Feb 14, 2018 11:08 am
Re: [Solved] Auto Sync Users Community Builder and Joomla - NEW
My Joomla version is 3.8.3
and com_user/register is not in my Joomla
I have com_user/controllers/registration.php and models/registration.php
where do I add this code?
Please Help me
Thank you
and com_user/register is not in my Joomla
I have com_user/controllers/registration.php and models/registration.php
where do I add this code?
Please Help me
Thank you