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.

$DatabaseColumns mapping problem

edited March 2008 in Vanilla 1.0 Help
Hey all,

I recently followed the wordpress integration tutorial and setup a forum/blog hybrid. A bit more tinkering with the login/session stuff has made this quite seamless now.

The problem im having is accessing Wordpress information from within Vanilla. It was my understanding (from the article) that I could map different DB columns into my User object like this, in conf/database.php:

// Also map the Wordpress columns into Vanilla $DatabaseColumns['User']['display_name'] = 'display_name';
However when I test in the forum the $this->Context->Session->User object doesnt have this field.

Similarly, I tried to map a new $Definition in conf/language.php like so:

$Definition['SignOut'] = 'Logout';
And this doesnt display in Vanilla.

Can someone give me a pointer here? Until I work out what's going on with the architecture of Vanilla, it's really difficult to debug.
Thanks all!
mafro

Comments

  • edited March 2008
    If you are mapping new items to the user object, it won't have the property until its been retrieved from the database, which means you will have to edit the library/Vanilla.Class.User.php file and add that line to the GetProperiesFromDataset() function. It's probably better to map the existing Vanilla property to the Wordpress naming convention--so assuming that the Wordpress' display_name column is basically the same as Vanilla's name property, you would map it this way: $DatabaseColumns['User']['Name'] = 'display_name';

    You're basically telling Vanilla to look for a column in the database called 'display_name' instead of Vanilla's default of 'Name'.

    Dictionary definitions should also be written in Vanilla's conventions like they are in language/English/definitions.php:$Context->Dictionary['SignOut'] = 'Logout';
    You only need to copy & paste the definitions you want to change to conf/language.php
  • Thats great WallPhone, thanks for the reply. Very concise and to the point, 5 stars.

    I had clearly just got the Dictionary bit wrong - but I had assumed with the Database mapping columns stuff that the SQL was built dynamically from the column mappings you create in the configuration.. And wouldn't that make more sense?

    Anyways.. I got it working using your example above of mapping into 'Name'. It would be more useful for me if I could not overwrite the login name, and say for example map onto a different Vanilla column:
    $DatabaseColumns['User']['FirstName'] = 'display_name';
    However this doesn't work..
    Any input appreciated.
    mafro
This discussion has been closed.