Fork me on GitHub

Registering new user variables  Bottom

  • Hi guys,

    I have a question ... although I think I know the answer ...

    In the API documentation ( http://docs.postnuke…w&f=pnapi/re50.html ) it says:

    Quote

    Other (user) variables will be made available in future releases of the API. You can register new user variables with the register_user_var module API function included in Modules module.


    The register_user_var is not implemented yet and its been a while as I can see on these forum posts:
    http://forums.postnuke.com/index.php?name=PNphpBB2&file=viewtopic&t=33357&highlight=registeruservar
    http://forums.postnuke.com/index.php?name=PNphpBB2&file=viewtopic&t=13629&highlight=registeruservar
    http://forums.postnuke.com/index.php?name=PNphpBB2&file=viewtopic&t=8751&highlight=registeruservar

    Is there a new way of registering user variables since then?

    Or

    do i have to create a function that adds that manually
    or even create my own table with such variables
    or maybe use a hook everytime user gets created? (please give me more info on this one cause I do not know much about hooks)

    In any case I think it would be good if "register_user_var" was implemented as it is a very important function ... you just have to define some sort of naming convention to ensure that the module defined variables do not have the same name with future Postnuke defined user variables.

    Alexan
  • and does pnUserSetVar work on 0.7.5.0

    if I do this:

    pnUserSetVar('EmailNotification','Y');
    echo pnUserGetVar('EmailNotification');

    I get nothing echoed ...
  • guys give me a hand here please...

    do user defined User Vars work at all?

    and if so how and when do you set them up?
  • I have the same problem. Im can get it to work most of the time with core fields, but not dynamic.
  • As you found out yourself, register_user_var is not in yet... So you cannot use a non core field by a non-existant name : EmailNotification

    Use the dynamics for that.

    Dynamic field : _EMAILNOTIFICATION
    After it is created, you can do your :

    Code

    pnUserSetVar('_EMAILNOTIFICATION', 'Y');
    echo pnUserGetVar('_EMAILNOTIFICATION');


    See this post for the available aliases and method to fetch core and dynamic fields.
  • Chestnut

    See this post for the available aliases and method to fetch core and dynamic fields.
    see what post? icon_wink
  • He is probably talking about this one: http://forums.postnu…pic&p=153145#153145
  • yea i saw lol... i was partially giving him a hard time, partially hoping to help next months searchers lol.
  • lol, thats why i always try to post my resolutions to posts after i get things fixed, etc. To archive the solution as I am ALWAYS searching these forums for answers. Forget documentation as it always falls behind, im for living documentation such as these forums.
  • ok, thanks guys

    I thought pnUserSetVar() would automaticallity create a variable for a user if it didn't exist .... it doesn't so everything is clear ...

    might try to create the "register_user_var" function if i find the time ...
    I 'll post it here if I do ...

    cya
    Alexan
  • Ok... I say it :

    Oups ! icon_lol
  • 0 users

This list is based on users active over the last 60 minutes.