Share Frontend Users Between Multiple Sites

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Share Frontend Users Between Multiple Sites

Post by Nullig »

If you want to share frontend users among multiple sites, redirect the registration to the main site (originating). Then set up the following crontab job for each site:

Minute: 1,16,31,46
Hour: *
Day of Month: *
Month : *
Day of Week: *

Command:
/usr/bin/mysqldump -h -u -p --quick --add-drop-table --add-locks --lock-tables --tables cms_module_feusers_belongs cms_module_feusers_dropdowns cms_module_feusers_grouppropmap cms_module_feusers_groups cms_module_feusers_groups_seq cms_module_feusers_propdefn cms_module_feusers_properties cms_module_feusers_properties_seq cms_module_feusers_tempcode cms_module_feusers_users cms_module_feusers_users_seq | mysql -h -u -p

This example will run the job every 15 minutes and synch the feusers tables between 2 sites.

Notes:
- This will work between different servers.
- You may need to change the path to mysqldump, depending on your setup.
- Replace the entries in with your specific database info.
- Replace the "cms_" table prefixes with your table prefixes.
- The command must be a single line.

Nullig
Last edited by Nullig on Tue Apr 08, 2008 7:35 pm, edited 1 time in total.
Pierre M.

Re: Share Frontend Users Between Multiple Sites

Post by Pierre M. »

Hello,

interesting, thx.

Some (humble) improvements suggestions for the future :
-use a parameter for the cms_ prefix.
-use another one to contain "module_feusers" to shorten the line.
-refine the SQL query to extract and import only the new entries (the ones from the last successfull import). Or doesn't it work this way already ?

Pierre M.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Share Frontend Users Between Multiple Sites

Post by Nullig »

This is strictly a crontab entry, not php code.

I suppose a module could be built using this as the basis.

Nullig
ameagher
Forum Members
Forum Members
Posts: 39
Joined: Sun Aug 12, 2007 4:01 pm

Re: Share Frontend Users Between Multiple Sites

Post by ameagher »

Hi Nullig,

This is a nice workaround!

However, for some people using shared hosting, and even vps accounts their isp will not allow them to run cron jobs more than once an hour.

Has anyone looked at openid for this within cmsms?

Cheers,
Anthony
Pierre M.

Re: Share Frontend Users Between Multiple Sites

Post by Pierre M. »

Hello Anthony,
ameagher wrote: Has anyone looked at openid for this within cmsms?
What do you mean ? I don't see the relationship between crontabs and openid.

Pierre M.
ameagher
Forum Members
Forum Members
Posts: 39
Joined: Sun Aug 12, 2007 4:01 pm

Re: Share Frontend Users Between Multiple Sites

Post by ameagher »

Pierre,

Sorry for not replying to your message quicker!

Quoting someone else (http://www.barnraiser.org/index.php?wp= ... penIDintro) about OpenID:
"What is OpenID?
OpenID gives you a way to login to many websites using a single identity with a single password. You control what identity information you give to the website and you control which websites you trust and which you don't - OpenID puts you in control with a single password to remember." - Simpler and more eloquent than I would have put it ;)

Some other cms are making use of it through modules e.g. Drupal.

It has no direct relationship to cron jobs as such! I was just asking if anybody had considered implementing it for cmsms?

The reason I made mention of the cron jobs is that some hosting companies prohibit/restrict end user use of regular cron jobs (i.e. less than hourly for example, so they may not be generally usable to control frontend logins across multiple sites if they need to be run very frequently.

Anthony
cubix
Power Poster
Power Poster
Posts: 314
Joined: Mon Jul 09, 2007 10:00 am

Re: Share Frontend Users Between Multiple Sites

Post by cubix »

cms 2.0 has openid support, however, whether it will be implemented for the frontend, i dont know.
Post Reply

Return to “Tips and Tricks”