[wp-hackers] Sharing Users/authentication

Stephen Rider wp-hackers at striderweb.com
Tue Aug 28 20:11:37 GMT 2007


On Aug 28, 2007, at 1:14 PM, 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.

It doesn't need any info from any table.

If the table prefix set in wp-config == $my_master_prefix : this is a  
Master.
If the table prefix set in wp-config != $my_master_prefix : this is a  
Slave.

Thus, $this_role doesn't need to be set by user.  Auto-detect! :)

Also -- it appears you hard-coded some variable data in the plugin.

Stephen



More information about the wp-hackers mailing list