The Joomla! Forum ™



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.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Sep 11, 2009 5:42 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Sep 11, 2009 5:35 pm
Posts: 3
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);

?>

_________________
For more information - GXI Solutions & Development: http://www.gxi.co.za


Last edited by pe7er on Fri Sep 11, 2009 7:53 pm, edited 1 time in total.
Self promotion is not allowed. Manual signature has been removed. Please use the forum signature (see profile) instead.


Top
 Profile  
 
PostPosted: Tue Sep 14, 2010 4:24 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon May 17, 2010 11:44 pm
Posts: 2
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 ?> )

Code:

// 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();


?>


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!


Top
 Profile  
 
PostPosted: Fri Jan 07, 2011 12:33 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Jan 07, 2011 12:26 am
Posts: 1
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.


Top
 Profile  
 
PostPosted: Fri Feb 25, 2011 9:32 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Sep 05, 2008 10:56 am
Posts: 9
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 ?> )

Code:

// 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();


?>


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 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


Top
 Profile  
 
PostPosted: Fri Mar 30, 2012 5:00 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Oct 17, 2006 3:41 am
Posts: 23
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 



Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group