Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
mapping lum_user to multiple tables
Has anyone tried mapping the users table to multiple tables from another app?
I have an existing app that has a main user table and an associated profile table. I'd like to add the extra Vanilla fields to the profile table and not the main user table. But the trick is, *some* of the fields like password and user_id are in the main table.
So Vanilla would have to search both of those tables to extract data. But I only see a way to re-map the user data to a single table.
Has anyone done this or have a good idea on how this could be accomplished?
Thanks!
0
This discussion has been closed.
Comments
You can't map the user table to multiple tables but you can extends the UserManager class so that the User object is populated with data from different table. But this new UserManager won't be used for creating $Context->Session->User because it is created before the extensions are loaded. I might be able to fix that in Vanilla 1.1.5.
I am away today and tomorrow, so I can patch Vanilla right now but it will be like replacing the default authenticator. Vanilla won't include People.Class.UserManager.php but the file defined in $Configuration['USER_MANAGER_MODULE']. I still have to see how the BuilderFactory will also know which UserManager class to use.
You just need to create on extensions (e.g.: MyExtension) and create the files for you version of UserManager (e.g.: MyUserManager) and maybe User (e.g.:MyUser):
/Path/To/extensions/MyExtension/People/People.Class.MyUserManager.php
/Path/To/extensions/MyExtension/People/People.Class.MyUser.php
then in /Path/To/extensions/MyExtension/default.php:
[...] if (!isset($Configuration['MY_EXTENSION_VERSION'])) { // Adds persistence Object Factory reference AddConfigurationSetting($Context, 'OBJECT_FACTORY_REFERENCE_USER_MANAGER', 'MyUserManager'); AddConfigurationSetting($Context, 'OBJECT_FACTORY_REFERENCE_USER', 'MyUser'); // Tells vanilla where to find your class AddConfigurationSetting($Context, 'LIBRARY_INCLUDE_PATH', $Configuration['LIBRARY_INCLUDE_PATH'] . ';%EXTENSIONS%/MyExtension/'); AddConfigurationSetting($Context, 'MY_EXTENSION_VERSION', '0.1'); }