Predefined User-Attributes Extension
  • Hi.
    I wrote an extension which allows administrators to predefine attributes. Administrators may add custom fields like "Phone-Nr." or "Shirt-Size" (Respect your users privacy) to the Accounts-Page. User may fill this information on Appliance and on the Account "Personal Information" page.

    http://twoantennas.com/sr/wp-content/files/2006/04/PredefinedAttributes.php.zip

    http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=20 (edited)

    The extension uses the field "Attribute" in "User" table and disables user-defined "Label"-"Value" pairs. The "User" and "UserManager" classes are extened. The "CustomIdentityForm" and "CustomApplyForm" classes are overwritten to handel user inputs.
    In the first version the extension has to be configured in the php-file.

    I'm working with Vanilla since a short time. This is my first extension. I hope to get some feedback and tipps in this forum.

    Thanks,
    Michael
  • MinisweeperMinisweeper
    Posts: 5,574
    I hope you'll be adding this to the new repository?
  • MarkMark
    Posts: 4,880
    Sounds great - you should upload it to the Vanilla Add-Ons directory :)
  • MinisweeperMinisweeper
    Posts: 5,574
    /me shouts ECHO! and listens to it reverberating round the room.
  • MarkMark
    Posts: 4,880
    doh~!
  • I have no screenshot yet and will add it tomorrow.
  • BergamotBergamot
    Posts: 1,876
    This is for 0.9.2?
  • Yes, Version: 0.9.2 Where do I get 1.0?
  • BergamotBergamot
    Posts: 1,876
    A couple days from now, you'll be able to get it right here.
  • ccmehilccmehil
    Posts: 70
    @michaelontheroof

    Very nice extension - however without realizing it I killed some other user defined labels that were already there :-) no prob though.

    Make sure you get yours up in the new add-ons area!
  • Now in the add-ons directory:
    http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=20

    @ccmehil: I added a warning to the description, which will be displayed in the extension manager. Sorry for your losses.
  • ccmehilccmehil
    Posts: 70
    No big lose, helps if I read first though :-) again no biggie and excellent extension.
  • I added two new functions to the extension: 1) Attributes may now be declared as hidden, and are then only visible for administartors and the user itself. 2) The type of a form element for an attribute can be defined as "select", "radio" or (text)"input". So <select>-fields and Radio-Buttons are possible with custom values. ..Thanks to Vanillas Select and Radio class.. @Bergamont: Are there many differences between extension development for 0.9.x and 1.0? Is it possible to check out an unstable 1.0, anywhere? I'm now going to write an export extension for user data and it would be nice to make sure it'll work in 1.0, too.
  • MinisweeperMinisweeper
    Posts: 5,574
    you can grab the latest copy of 0.9.3 off the svn, which is the version being beta tested over at the vanilladev site, and once all the bugs have been ironed out will be released publically as v1. There will be no major code changes (besides eradicating bugs, i suspect 99% of which will be part of the theme side anyway) between now and then so if you want to code some extensions for v1 then thats your best bet.
  • ithcyithcy
    Posts: 1,290
    what minisweeper said.

    the major difference is that in 0.9.3 and 1.0, extensions reside in their own folder.
    in 0.9.2 it was like: extensions/MyExtension.php
    in 1.0 it's like: extensions/MyExtension/default.php.

    i've changed several 0.9.2 extensions to the new format just by renaming them and so far they've all worked fine.

    also this thread has information about the SVN.
  • minisweeper, ithcy,
    thank you for this info and the right links
  • I released Predefined Attributes Extension for Vanilla 1 over here: http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=20.

    Any suggestions and feedback?
  • hutsteinhutstein
    Posts: 216
    I've tried the Extension for Vanilla 1 and I only get the following error:

    Parse error: parse error, expecting `')'' in /home/webtree/htdocs/vanilla/extensions/PredefinedAttributes_v0.3.1/default.php on line 102
  • Hello hutstein,

    i don't have this error. In line 102 is the Constructor

    function PredefinedAttributes(&$Context, &$User = null) {
    Which php Version are you running?
    In old version you may have to change it to

    function PredefinedAttributes(&$Context, &$User = false) {
    Grüsse aus Hamburg*
  • hutsteinhutstein
    Posts: 216
    It's PHP Version 4.3.3

    i've changed it to
    function PredefinedAttributes(&$Context, &$User = false) {
    but it doesn't work. I get the same error.

    If i Change it to
    function PredefinedAttributes($Context, $User = null) {
    I don't get this error, but the extension doesn't work...

    Grüsse aus Deggendorf, Bayern
  • I'm sorry, I'm not sure why it won't work for you

    Does anyone else got the same error on Line 102?
  • ithcyithcy
    Posts: 1,290
    that has to be an error in the array definitions above line 102. post your $Attributes array for us, hutstein?
  • Good idea ithcy.
    I didn't thought that far..
  • ithcyithcy
    Posts: 1,290
    incidentally, the extension doesn't work on my local vanilla either, but it's not the same problem :)
    it won't install itself and gives no errors. i'm trying to figure out why. (php 5.1.1/ mysql 5.0.18)
  • hutsteinhutstein
    Posts: 216
    I hadn't changed the $attributes array it's exactly like i've downloaded the extension:

    Sorry I don't know how to post code formatted... now i know it

    var $Attributes = array(
    array(
    "Label" => "Phone-Nr.",
    "Required" => true,
    "Value" => "",
    "Hidden" => true,
    "Description" => "A short description will be displayed on the personal Information page only."
    ),
    array(
    "Label" => "T-Shirt-Size",
    "Required" => false,
    "Value" => "M",
    "Hidden" => false,
    "Type" => "Select",
    "Data" => array("XS", "S", "M", "X", "XL")
    ),
    array(
    "Label" => "City",
    "Required" => false,
    "Value" => "m",
    "Hidden" => false,
    "Type" => "Select",
    "Data" => array("Tokio", "Mexico", "New York", "Mumbai", "Sao Paulo", "Delhi")
    )
    );
  • ithcyithcy
    Posts: 1,290
    put <code></code> tags around it

    that's funny.. have you changed anything else ?
  • hutsteinhutstein
    Posts: 216
    No I haven't changed anything else, I only renamed the extension to default.php and created a folder "PredefindedAttributes"
  • hutsteinhutstein
    Posts: 216
    when I change it like this, it works:
    function PredefinedAttributes(&$Context, &$User) {

    is the default value false or null important?
  • Thanks to ithcy for taking the time to try an installation. Did you call "settings.php?PostBackAction=InstallPredefinedAttributes" after enabling the extension in the extension manager page? You need to do so, so the "PredefinedAttributes" column will be created in the Users table.

    hutstein, right: the filename has to be default.php.

    Parse error: parse error, expecting `')'' in /home/webtree/htdocs/vanilla/extensions/PredefinedAttributes_v0.3.1/default.php on line 102

    is a typo error I don't have in the file.
  • ithcyithcy
    Posts: 1,290
    @michaelontheroof: yes, i did that before, but it still didn't install.
    but i changed line 102 to &$User=false and did it again, and it works!
    thanks for the tips :)
  • ithcyithcy
    Posts: 1,290
    p.s. i have a request for the next version: checkboxes!
    thanks again.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Who's Online 2

JhauraWpaintballer82