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.
Options

Adding to the Indentity Form

edited January 2006 in Vanilla 1.0 Help
I'm trying to add 'blog name' and 'blog url' into the user identity area, but I'm just missing something. Any help is appreciated!

Here's my code:

// Add the Blog Info setting to the forum preferences form if ($Context->SelfUrl == "account.php" && $Context->Session->UserID > 0) { $PostBackAction = ForceIncomingString("PostBackAction", ""); if ($PostBackAction == "Identity") { $BlogName = ($Context->Session->User->Setting("BlogName",0)==0) ? "": $Context->Session->User->Setting("BlogName"); $BlogURL = ($Context->Session->User->Setting("BlogURL",0)==0) ? "": $Context->Session->User->Setting("BlogURL"); $BlogInfoOption = "<h2>".$Context->GetDefinition("Blog Information")." - Ignore for now</h2> <dl> <dt>".$Context->GetDefinition("Blog URL")."</dt> <dd><input type=\"text\" name=\"BlogURL\" value=\"".$BlogURL."\" maxlength=\"50\" class=\"SmallInput\" id=\"txtBlogURL\" /></dd> </dl> <dl> <dt>".$Context->GetDefinition("Blog Name")."</dt> <dd><input type=\"text\" name=\"BlogName\" value=\"".$BlogName."\" maxlength=\"50\" class=\"SmallInput\" id=\"txtBlogName\" /></dd> </dl>"; $Context->ObjectFactory->AddControlString("AccountForm", "RenderCustomPreferences", $BlogInfoOption); //$Context->ObjectFactory->AddControlString("IdentityForm", "RenderCustomPreferences", $BlogInfoOption); } }

Comments

  • Options
    MarkMark Vanilla Staff
    Adding it there is one thing, but you've still got to save it to the database. Are you using 0.9.2 or 0.9.3?
  • Options
    i'm using 0.9.2.6, but the above doesn't actually add the fields to the page. i'm sure it has something to do with the AddControlString at the end being incorrect... it works fine for the FunctionalityForm, but not for IndentityForm.

    Once that works, I will move on to saving it.

    thanks!
  • Options
    MarkMark Vanilla Staff
    Oh, there is no RenderControlStrings method in the identity form, which is why it isn't displaying. The ControlStrings were kind of a novel idea added towards the end of 0.9.2 development. You options are: a) Add a new RenderControlStrings method to the Identity form (wherever you want the inputs added - check out the FunctionalityForm control for reference) b) Just manually alter the control to add those inputs. c) Make a whole new identity form control (named whatever you want) and change the object factory to reference your new control instead.
  • Options
    Idea. Why not include the option to have an xml file that provides a schema of data that people want to add to their user registrations. Then it will get put into the meta fields the xml file could also dictate if you provide a text field, drop down list or radio buttons for the data.
This discussion has been closed.