Using external users-table instead of serendipity_authors

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
liadim
Posts: 3
Joined: Wed Jul 18, 2007 4:13 pm

Using external users-table instead of serendipity_authors

Post 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…
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Using external users-table instead of serendipity_author

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
liadim
Posts: 3
Joined: Wed Jul 18, 2007 4:13 pm

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
liadim
Posts: 3
Joined: Wed Jul 18, 2007 4:13 pm

Post 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!!!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
queej
Regular
Posts: 6
Joined: Thu Aug 16, 2007 10:15 pm

We Have the Same Issue

Post 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.
Cheers,
-queej
Post Reply