Background:

I have a multisite Drupal install with shared databases (two sites, database prefixes are site1_, site2_ and shared_). Also, I've embedded Gallery in both.

I've been working on this for a while using Apache on my Windows computer. I got everything how I liked it and was getting ready to go live when I noticed that I couldn't get into the Administration section in Gallery on site1. Long story short, I messed around with users to get them to match between Drupal and Gallery to get this working.

BUT...I realized too late that I am no longer able to get into the Administration section of Drupal on site2! Given the timing of things, I'm almost certain that I deleted the administrative user for site2. To back up this claim, if I look at the database, there are no entries for site2_users_roles. Additionally, somewhere along the line I seem to remember messing around with roles and permissions, which may be compounding my problems.

Description of Problem:

Similar to many other posts, I am allowed to create the first account. I've also messed with the settings enough to make it so I can't create the password and it tries to email me, which I haven't been able to get to work, but I can see the new user in site1 Admin and can change the password there. So I log in with this first "Administrator" account or any of the Site1 accounts, but I can only go to "My Account" or "Log Out". If I try to go to the Administrative Section (which is still an option from the front page), I get:

Access denied
You are not authorized to access this page.

...as if I were a guest.

What I Tried:

I tried creating the necessary users, roles and permissions in MySQL. I got what I wanted to appear in the tables, but it didn't change the situation.

Although I can't see why this would matter, I also tried setting up the mail function in both php.ini and common.inc. I still can't get mail to send with either my work account or gmail, although at least I get different error messages when I change certain things. I think this is really unnecessary, so, as an aside, can anyone tell me either 1) how to set passwords without an email message OR 2) how to have this information written to a local log/text file instead of an email message? I'm not very comfortable with PHP and MySQL, so please be very explicit.

-K

Comments

cog.rusty’s picture

Can you list the sharer or unshared tables here? (whichever are fewer). We may spot some conflict.

I assume you have separate users tables. Do both your sites' users tables have a user with uid=1 now? Can the user #1 of both sites log in successfully?

If they can log in but they can't go to admin, try to empty ("truncate") all your "cache" and "cache_something" tables with the corresponding prefix (or all of them).

A "users_roles" table doesn't need to have any entries. The roles 'anonymous' (#1) and 'authenticated' (#2) don't need entries there (only in the "role" table). "users_roles" is for additional roles.

Every "users" table must contain an (empty) user #0 and a user #1.

--------------------

If a user #1 is missing from a users table, you can add it with phpmyadmin using

INSERT INTO yourprefix_users (uid, name, pass, mail, status)
VALUES(1, 'admin', md5('yourpass'), 'yourmail@example.com', 1)

If you just want to update the password, then

UPDATE yourprefix_users SET pass = md5('yourpass') WHERE uid=1

**BUT** when you are doing any of this, use only English letters or check the character encoding of the phpmyadmin page in your browser's menu to make sure that it is UTF-8.

k_and_j’s picture

I assume you have separate users tables.

I don't have separate users tables, just separate user roles and permissions. The 2 sites are linked, so I want users to be able to go back and forth, just not have the same access level on both sites:

'users' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'authmap' => 'shared_',
'sequences' => 'shared_',

Do both your sites' users tables have a user with uid=1 now? Can the user #1 of both sites log in successfully?

No uid=1 ... this is probably what I deleted when I "fixed" the gallery problem.

If a user #1 is missing from a users table, you can add it with phpmyadmin using

INSERT INTO yourprefix_users (uid, name, pass, mail, status)
VALUES(1, 'admin', md5('yourpass'), 'yourmail@example.com', 1)

PERFECT! Works now (including the gallery site admin)...Thanks so much and good to know about users #0 and #1!

-K