OK, all of you dolphineers, I have returned again with a very peculiar question, and really hope someone can point me on the right path. Before I get started, just wanna say thanks for taking the time to check it out.
Heres the deal. I am running two installs of 7.1.2. Both were manual installs and everything is working fine. Install number 1 is at mydomain.com and install number 2 is at mydomain.com/username.
For ease of explaination, lets say site number 1 is a a directory of DJ's. Someone can go to this site and find a local DJ for whatever reason. Now, Lets say a DJ decides that they want their own site. When I go to mydomain.com, I find a DJ, and when I click on their image or name, instead of taking me to that DJ's profile page which is within mydomain.com, it goes to a separate install of dolphin which is in a folder that is labeled the same as the username of the DJ. Which would be accessed by going to mydomain.com/username. I really hope this makes sense.
Now, I have already purchased a mod to sync the two sites, and it is such that if a person happens to go to the DJ's website instead of the main domain, that the account would be synced with the main domain so that they do not have to create a whole new account.
Here is where my question comes in: Say, I am looking for a DJ and I find one, hire them and all goes well. On the main site, I can do all the cool things that dolphin can do. One day, the DJ decides he wants his own site and we get everything set up for him. I go to the main site looking for the DJ and I log in and all that. I click on the (what used to be ) profile link and I am taken to their new website. Is there a way to have the cookie variables retained so that I do not have to sign in all over again (my profile info would be synced to the new DJs website already)?
caredesign.net |
Am I to understand that the DJ's site is a Dolphin site? Or, are you using a different CMS; not a social networking CMS, for the DJ's site? I mean the DJ would not need a Dolphin site just for the DJ's stuff, correct? Geeks, making the world a better place |
both sites are dolphin sites. I am just using a DJ site as an example to exolain what is going on. The actual usage is alot more complicated than that but the fundamental coding would be the same, everything else i have taken care of. Just trying to see if there was a way to carry the cookie variables down.
After giving this more thought, I was thinking maybe I could catch the cookies and turn them into php variables, and then use those variables to override the normal login setting of variables, but that would require some crazy coding. Was hoping there was a simple solution.
caredesign.net |
Where are the bits and pieces in Dolphin that handles the cookies? You should be able to make changes for Dolphin site 2 to use the cookies from the main Dolphin site. So if someone is logged into the Dolphin site main and goes to Dolphin site 2 that is their site, then they are logged into that site as well. If they go to Dolphin site 2 while not logged into Dolphin site main, and they log into Dolphin site 2 which sets the same cookie that Dolphin site main sets and uses, then they can go to Dolphin site main and be logged in their as well. Similarly, if they log out of Dolphin Site 2, it will log them out of Dolphin site main. Geeks, making the world a better place |
Assuming these are synced sites. That is each sites members are identical. Same ID, same Password. Then it should be easy.
Sites on the same domain have access to the same cookies, so all you need to do is adjust the path set in the cookie so each site uses the same cookie instead of creating a new one.
Look at the functions bx_login and bx_logout in inc/profiles_inc.php
Adjust the function to force the path to always be '/' And do that for all the sites.
Doing that should make all the sites use the same cookie. Thus when you log into the main site then go the the second site, the second site sees the cookie and uses it so they should already be logged in.
I have not tested this of course, but in theory it should work.
Note. This will not work if the member id and/or password is not the same on both sites.
https://www.deanbassett.com |
Note. This will not work if the member id and/or password is not the same on both sites.
So you would want to remove registration from site 2; which means that you have to manually set up the profiles on site 2 or use a script to copy the profile from the main site database to the site 2 database.
Geeks, making the world a better place |
upon initial install of DJs site, those who are subscribed to or friends of the DJ will have their memberships copied to the DJs site, So their information would be identical to the main site. After initial install of DJs site, any other new members to the DJs site (regardless if they have an account on main site) will have to create a new membership on the DJ's site.
@GG - i still need the registration on the DJs site
@Deanos, how does your suggestion work for those who go straight to the DJs site and not the main site and create a new membership. Although the synching script will copy memberships from DJ site to Main site, they will have a different ID number on the main site.
caredesign.net |
@Deanos, how does your suggestion work for those who go straight to the DJs site and not the main site and create a new membership. Although the synching script will copy memberships from DJ site to Main site, they will have a different ID number on the main site.
It won't work. As i said. It will only work if the sites member id and password are exactly the same.
So if you need to do that, then your going to have to write scripts that are able to look up accounts and rewrite the cookies. But even then, something has to match between the two sites in order to match the accounts. It's not going to be a easy task.
https://www.deanbassett.com |
That was quick Deanos - lol. But - the only thing that is different is the ID, the username and password would all be the same.
After talking with project manager, we have decided that it is only the DJ whose login I need to synch from Main site to DJ site.
Your answer gives me hope.
caredesign.net |
But - the only thing that is different is the ID
And that is the reason it will not work. The cookies store ID and password. Not nickname. So you would still need some kind of scripting to set the proper id in the cookie when the site changes.
But yes, being the nick and password are the same it will make it easier as you can use the current id and pass to get the nick from the main site then match that nick and pass on the other site to find the ID and set the memberID cookie.
https://www.deanbassett.com |
Ok, here is something you can do. Should be quite simple.
Have the bx_login function in inc/profiles.inc.php write a new cookie to store the nickname.
Then
You would need to place some script in inc/design.inc.php. I suggest that script because it is run on every page load.
EDIT: Best location would most likely be at the top PageCode function.
Have it look up the id of the nick that is in the memberID cookie. If it does not match then change the cookie to the proper id and refresh the page. The page refresh is important because the browser will not have the cookie value until the page is refreshed.
Do this in the code of each site and it will switch the cookie to the proper member id. Because the password is the same you do not need to touch that cookie. You will still need to make the other changes to the cookie path i suggested earlier.
https://www.deanbassett.com |