Page 1 of 1

Using external users-table instead of serendipity_authors

Posted: Wed Jul 18, 2007 4:45 pm
by liadim
Hi
I am using s9y (which is great!!!) in a communities site. Each defined group has a private blog, viewed only by members of this group and written by the group's manager.
When a new user registers to the site, his personal details are stored in the site "users" table.
My question appears to be simple: can I tell s9y to look for details such as login, password, email etc. in the site's "users" table instead of serendipity_authors?
Another related question is: when a user writes a comment, and since there are no "anonymous" users in this site, I would like his name and mail to appear automatically (from the "users" table), instead of letting him fill those fields by himself.
I thought of modifying a plugin such as serendipity_event_externalauth, which creates new entries in serendipity_authors, but I am not happy with this solution, since I will end up having the same data in two different tables. This can lead to troubles when updating or deleting a user from the site.
Is there a solution for this kind of implementation of s9y?
* BTW each group also have a forum, and it would be a shame if eventually each user record will appear in THREE tables…

Re: Using external users-table instead of serendipity_author

Posted: Thu Jul 19, 2007 9:47 am
by garvinhicking
Hi!

You cannot easily do this. If you are using MySQL5, you can create a virtual VIEW for a faked serendipity_authors DB table. That is advanced stuff, though.
Another related question is: when a user writes a comment, and since there are no "anonymous" users in this site, I would like his name and mail to appear automatically (from the "users" table), instead of letting him fill those fields by himself.
You can use the Plugin "User Self-Registration", this has an option to "prevent identity theft" and will auto-fill the logged in user name into the field. You can disable the other functionality of the plugin that allows users to become members on their own.

HTH,
Garvin

Posted: Thu Jul 19, 2007 2:03 pm
by liadim
thank you very much for your quick answer!
I will try to create the records on serendipity_authors with a view. would that be enough for "faking" the current new-user registration? or are there other tables that are modified when a new user is created, beside serendipity_authors?

Posted: Thu Jul 19, 2007 2:47 pm
by garvinhicking
Hi!

Partially. A VIEW can only be written to (INSERT, UPDATE) if it contains a 1:1 relation (see http://dev.mysql.com/doc/refman/5.0/en/create-view.html). So if you map a foreign user database to serendipity_Authors and it has extra columns, serendpity will no longer be able to update/write to the serendipity_authors table.

So in many cases you loose the ability to add new users within serendipity, and must instead add those users using the central user database.

Serendipity itself stores user properties and group associations in the serendipity_authorgroups and serendipity_config tables. Those only refer to the ID of serendipity_authors, so you might need to update the master user database process to insert values into those DB tables, yes.

Best regards,
Garvin

Posted: Thu Jul 19, 2007 4:33 pm
by liadim
I want to add users only through the central user database and not within serendipity, so I think your solution will work for me. It also probably sovles the forum problem - thanks!!!

Posted: Thu Jul 19, 2007 7:38 pm
by garvinhicking
Hi!

I'd be very interested in your results. So far I've only theortically evaluated this solution but never tried it "live". So you could help a lot by telling us how to proceeded, and if you faced any trouble along the way. :)

Best regards,
Garvin

We Have the Same Issue

Posted: Fri Aug 24, 2007 6:05 pm
by queej
Please do post your results. We are integrating Serendipity into our web application, which already has user registrations in another database entirely. We want to quietly log our users in as blog authors behind the scenes.

Any tips folks might have would be greatly appreciated. Likewise, we'll share what we come up with as well.