[wp-hackers] Re: Re: Re: Sharing Users/authentication

Curt Woodard clwoodard at gmail.com
Tue Aug 28 18:14:46 GMT 2007


>This is very cool.  I've been tinkering with this kind of thing
>myself, and ran up against the table-prefix problem.  A couple
>thoughts...
>
>On Aug 28, 2007, at 11:52 AM, Curt Woodard wrote:
>
>> * The administrator need only modify 3 variables in the plugin:
>> $this_role, $my_master_db,
>>   and $my_master_prefix. $this_role tells WordPress if the copy is
>> a slave or a master and the other two are pretty self-explanatory.
>
>It seems you could automate this with a simple logic test.  If the
>table prefix of the table used is the same as the current install's
>prefix, then it is the master.  Otherwise it is a slave.

Well, here's the deal: tying the usermeta tables together as well
causes the info from the slave to disappear. So when it uses the
master tables, it doesn't have any of the settings for the users. Now,
I just copied over the <slave_prefix>user_level, and
<slave_prefix>capabilities of the admin user when you run the plugin.
That gives the "install admin" full admin rights on any and all copies
of WordPress that use this plugin.

>> You can download the plugin from http://www.lyonesse.info/WPP/ (a
>> simple, crude, yet effective page).
>
>I'm definitely testing this out.  I'll let you know if I come across
>any issues or ideas. :) Thanks!
>
>Would you object if I took some of this and rolled it into a separate
>system I'm working on?
>(This thing: <http://striderweb.com/nerdaphernalia/2006/10/hello-
>again-world/>)
>
>Regards,
>Stephen

Yeah, let me know what you think! :) I hope it works out for you.

I did find a bug, however, seems that when you register a user in the
'slave' as a subscriber, it doesn't save the info to the master's
usermeta... *ponder* looking into that.

-> WAIT, no, no real bug. This is correct. In the slave copy, my test
user is set to Subscriber. In the master copy, my test user is set to
nothing (no role) so it's working. You have to go into the master copy
and upgrade the test user so that you can have a different role. :)
KO. *whew* :)

If you want to use the plugin, go ahead. If you want to rip it apart
and paste it into something you're working on? Go ahead, just credit
where credit is due... that's all I ask ;)


More information about the wp-hackers mailing list