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.

How to remove selected account settings

kalikianakalikiana New
edited February 2008 in Vanilla 1.0 Help
I have written an extension based on AccountPictures that allows users to choose a predefined avatar or upload a custom image, depending on two group permissions. Now I would like to remove the URL text entry that allows users to use arbitrary images as avatars. If this really is not possible within the bounds of an extension I am ready to tweak Vanilla for this particular setup.

Comments

  • Should be possible to remove it by hijacking the code at a specific point with a delegate. If not, you can always use javascript to remove it on page load and then hijack any post data to ensure users can't set their avatar even if they manage to get around the javascript.
  • Yes, that's pretty much it. But although the code is structured quite nicely I can't seem to figure out the right way. I would like to prevent the entry from appearing in the form in the first place, without any script hacks. At this point I'm not even sure where the control, in Vanilla terminology, is defined in the source.
  • edited February 2008
    I'm assuming you mean the field on the Personal Information page. If so the control is library/Vanilla/Vanilla.Control.IdentityForm.php and the theme file is themes/account_identity_form.php. It looks like the field is hard-coded though so javascript is probably your only option unless you create a new theme as well and specify that your extension needs to be used with that theme. I would vote for javascript though. You also need to hijack the post data though to prevent people circumventing the javascript. You can do that in the default.php of your extension. Just check for a SelfUrl of 'account.php' and, using ForceIncomingString, check the PostBackAction is 'ProcessIdentity'. From there you can unset the post data variable for the icon.
  • Ah, library/Vanilla/Vanilla.Control.IdentityForm.php does the job. Thank you very much. I will go with this unless a future version of Vanilla supports what I need. I can't really count on javascript here, since it would confuse everybody who has disabled scripts
This discussion has been closed.