$30 for Multi site with shared log in
I searched a lot, I tried a lot but I could not achieve a multi site configuration with shared user login. I gets multi site setup but can't get shared log in to work. I am trying it in cpanel hosting environment with multisites being installed in sub domains.
My prime goal of installing multisite is to get shared login among all the sites except the base site. Now I am giving $30 through Paypal to anyone who helps me achieve multisite with shared login. You should read on below what I exactly want.
Suppose my main site is www.example.com with drupal 6 installed on it. Now I want multi sites in sub1.example.com, sub2.example.com and so on but with shared logins. Logins will be shared only among sub domains and not on the base site www.example.com. That is User registered at sub1 should be able to login at sub2 or sub3 but not at www.example.com.
It doesn't matters whether database will be sharing or separate. I simply want working shared login in multi site environment. BTW, I tried as mentioned at http://drupal.org/node/147828 but was of no worth.

No Offense
This sounds like a fairly large project. I can almost guarantee that none of the developers on here will take on this project for $30. Most of them make significantly more per hour and your project will be atleast a couple hours. What I would suggest is to read around a little more. This page is for 5.x but should still be fairly accurate.
http://drupal.org/node/147828
Also, if you want the users to be able to register on the main site but not be able to access it there are 2 ways of doing this. One easier than the other.
The hard way.... custom coding to add a form to register users to a different table prefix.
The easy way.... one user database for all sites including the main site and use your user roles to decide what they can and can't access.
Access denied
I did as guided at http://drupal.org/node/147828. After multisite was completed when I logged into sub1 and clicked on any link I was logged out. Then I logged in again and was taken to the previously clicked link but when I clicked on any link again I was logged. Similar was the case with sub2 and sub 3 as well.
BTW I am not asking anyone to do it for me instead just guide me on doing this. I think $30 is enough for guiding on this.
The main thing is the
The main thing is the database settings in the settings.php. Are you sure you setup sessions to 'shared' table prefix? That sounds like it could be your problem.
Yes
Yes, I set "shared_" prefix in settings.php of both the sites for tables to be shared but this caused one problem. Only first site was installed then because it gave "database already exists" warning for the second site.
So I changed shared_ to shared1_ for the second site and fortunately installation was successful for both the sites but unfortunately user gets logged out after every click in both the sites.
I think I understand
Try this. To install your second site, in settings.php, only set the main table prefix first.
$db_url = 'mysql://db_user:password@localhost/site_db';$db_prefix = 'site2_';
Then once the second drupal installation is installed go back into your settings.php and change it to
$db_url = 'mysql://db_user:password@localhost/site_db';$db_prefix = array(
'default' => 'site2_',
'users' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'authmap' => 'shared_',
'sequences' => 'shared_',
);
Remember that the admin account that you create during installation of the second site will not work after you change these settings. You will need to use the admin account from the main site. Let me know if this fixes it.
Solved
Problem is solved. I tried again as mentioned at http://drupal.org/node/147828 and surprisingly it worked this time. Earlier I was duplicating settings.php in sub sites through FTP but this time I did it through SSH and successfully it's done now. I kept shared1_, shared2_ etc instead of shared_ in different settings.php files. Anyway thanks to all of you for your valuable comments.
I don't think that's going to
I don't think that's going to work. If all of the sites don't use 'shared_' and they each have their own 'shared1_' and 'shared2_' they are not going to be able to share users.
New problem now
You are right. I notice that this is working for uid=1 only for which I executed the SQL query in phpadmin.
INSERT INTO `shared_users` (name,pass,mail,mode,sort,threshold,theme,signature,created,access,login,`status`,language,picture,init,data)SELECT name,pass,mail,mode,sort,threshold,theme,signature,created,access,login,`status`,language,picture,init,data FROM `shared1_users` WHERE ( `shared1_users`.`uid` = 1 )
So no shared login for uid=2, 3 and so on. What should I do to share login for those users as well. Does replacing uid=1 with uid=% will do anything or is there a way to use same shared_ table prefix for all settings.php files.
Removed WHERE ( `shared1_users`.`uid` = 1 )
Ok I removed WHERE ( `shared1_users`.`uid` = 1 ) from the
INSERT INTO `shared_users` (name,pass,mail,mode,sort,threshold,theme,signature,created,access,login,`status`,language,picture,init,data)SELECT name,pass,mail,mode,sort,threshold,theme,signature,created,access,login,`status`,language,picture,init,data FROM `shared1_users` WHERE ( `shared1_users`.`uid` = 1 ) such as it becomes
INSERT INTO `shared_users` (name,pass,mail,mode,sort,threshold,theme,signature,created,access,login,`status`,language,picture,init,data)SELECT name,pass,mail,mode,sort,threshold,theme,signature,created,access,login,`status`,language,picture,init,data FROM `shared1_users`
and now it works for all the uid's.
The easiest way to have done
The easiest way to have done this is in your settings.php file. Just change the table prefixes from 'shared1_' to 'shared_'. I would suggest doing it the way you have. Could cause problems.
I did exactly as you told
I did exactly as you told earlier but that gave "Table Already exists" errors. So instead of using shared_ prefix I used different prefixes for separate sites. Anyway that is also not working exactly as wanted. It is taking admininstration rights from uid=1.
Make sure you are changing
Make sure you are changing the table prefixes after you install. If you set the 'shared_' prefixes before you run install.php that is a problem. If you change them after the fact that shouldn't be a problem. I've done it on sites before.
I am going to check this now.
I am going to check this now. Let me see if it works or not.
One more thing. I have installed drupal in the root directory and not in the /drupal directory. So what should be the command to create static links instead of "ln -s drupal site_1"
Got following errors given at
Got following errors given at http://drupal.org/node/401684 after using shared_ in both the sites. What to do now.
I was not using any special
I was not using any special modules for my setup. Let me know if you are using multisite or something. I'm going to tell you step by step what I did.
1 Setup all my domains or subdomains to point to the default drupal install directory.
2 Create db and db_user.
3 Download and extract Drupal to default install directory.
4 In '/sites/default' change the settings.php db settings to look like this.
$db_url = 'mysql://db_user:pAsSwOrD@localhost/data_base';$db_prefix = array(
'default' => 'main_',
'users' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'authmap' => 'shared_',
'sequences' => 'shared_',
);
5 Run www.mainsite.com/install.php
6 Create next domain folder under '/sites'. Name is something like 'www.sitetwo.com'.
7 Change db settings in the settings.php file to look like this.
$db_url = 'mysql://db_user:pAsSwOrD@localhost/data_base';$db_prefix = 'sitetwo_';
8 Run www.sitetwo.com/install.php
9 Go back into the settings.php and change the db settings like this.
$db_url = 'mysql://db_user:pAsSwOrD@localhost/data_base';$db_prefix = array(
'default' => 'sitetwo_',
'users' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'authmap' => 'shared_',
'sequences' => 'shared_',
);
10 Now you should have both sites functioning and sharing users.
Let me know if this doesn't work. This is how I did it and it worked fine.
Thanks jweberg, it works
Thanks jweberg, it works amazingly. thank you so much for giving your valuable information and time ofcourse. However there is still an issue. It's a 301 redirect which isn't working from WWW to non WWW.
Please tell me your paypal id so that I can give you your credit. I know this is too small for you but please take it as I can't give you more than this because of my inability. Please don't refuse.
Good.
The redirect can easily be fixed by a subdomain entry in your cpanel. Create a subdomain of *.site2.com and point it to your main drupal install directory. If this still gives you some problems just redirect the *.site2.com subdomain to www.site2.com. If you add other subdomains later with will only affect any subdomain not specified in your subdomain manager. Hope this helps. I'm glad you got it all working. Send me a link once the sites are live.
Justin
justin dot weberg at gmail dot com
Is this your paypal id. Just
Is this your paypal id. Just confirm it. I will look into the redirect issue soon.
Yeah it is.
Yeah it is.
Ok Paid. And redirection also
Ok Paid. And redirection also successful. cPanel supports such redirections.
thanks
Nikhil
Great. I'm glad its working
Great. I'm glad its working for you. Thanks for the chipin even though it was unnecessary.
1. if the sub_sites are
1. if the sub_sites are static, i.e. all are known and no new sub_site will be added
to share the user login, I will replicate the user records into all the sub_sites user tables.
i.e. when user A register user account in site A, the user record will also be created in all other sub_sites.
of course, account update should be considered.
let's me know if this cannot answer your request.
We go the drupal way. How about you?
http://www.drupalway.com
Hi this is Nikhil again. Now
Hi this is Nikhil again. Now I need a way to uninstall the multisite installation. I want to uninstall all the subdomains but not the main domian name. Please help me again.