Best Way to do this? FirstVisit Start Page  Bottom

Go to page [-1] 1 - 2 - 3 [+1]:

  • Michael,

    This won't help for .726 but for .8 there is a dynamic user data module with API's to add, delete etc. DUD properties so you'd be able to call the create API during your init script.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Cool, I won't submit that as a feature request then :)

    Is there anyway to do it in 726? I know where the DUD fields are stored, but where's the data for those fields stored, and how would I reference it as a value check?

    --
    Home Page | Find on Facebook | Follow on Twitter
  • The actual data is stored in <prefix>_user_property but the API's pnUserSetVar and pnUserGetVar should be used to read and write these settings - there's no need to interact directly with the table itself.

    -Mark

    --
    Visit My homepage and Zikula themes.</prefix>
  • So, if I put

    Code

    pnUserSetVar('pnFirstVist','1');

    In the init routines, that should create the nessecary field in the right place?

    THe field itself is stored in user_property and the data for that field in user_data right?

    --
    Home Page | Find on Facebook | Follow on Twitter
  • My previous post should have read <prefix>_user_data - sorry my fault....

    But apart fron that typo the answer to your question is yes but only if the DUD property 'pnFirstVisit' is known in the DUD property table - this is the problem with the .7x series the system's API's weren't finished.

    You can read and write a setting but only once the setting has been created so your init script would need to talk directly to the dud property table to create the property but once that has been done what you have works.

    I can see how this lack of a creation API came about as there is the potential duplication of DUD property names and no rules in place to govern naming of these.

    -Mark

    --
    Visit My homepage and Zikula themes.</prefix>
  • Hmm, user_property doesn't have a field for a var name, so how would the system know to store something as pnFirstVisit in the user's data?

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Michael,

    <prefix>_user_property holds the structure of the DUD property not the values themselves. <prefix>_user_data holds the values themselves using prop_id to identify which property the users value refers too.

    pnUserSetVar first checks the property table to check for a valid property name and in the process grabs the property id as well. This property id is then used to write the value for the variable into the data table. pnUserGetVar does the same except for a read on the data table in the last step. All of the code for the User API's are in includes/pnUser.php.

    -Mark

    --
    Visit My homepage and Zikula themes.</prefix></prefix>
  • What I'm not understanding is where the system finds out that pnUserGetVar('pnFirstVisit') is refering to DUD 17.
    <prefix>_user_property stores an id and a label, no name.

    The label is a language define.</prefix>
  • I see - If you look at the pnUserGetVar code 'pnFirstVisit' is the property label. The current definitions use contant defines so they can be multi-lingual in the user interface but this isn't a strict requirement for the property. I suppose property 'label' really should read 'name' to be clearer.

    So you define a new DUD property with the label being pnFirstVisit. The Set/Get API's then get the prop_id where prop_label is 'pnFirstVisit' and set the value with the prop_id.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Yeah, I just figured that out looking closer at the way the pnUserSetVar function works. Now if there's away to make that a hidden field that the user can't edit in their profile, all is perfect :)

    --
    Home Page | Find on Facebook | Follow on Twitter
  • You can if using the pnUserHack as there is field for administrative purposes only. However given this overrides the users module then you loose some of features added in .726.

    I've begun adding these kind of features based on pncUserHack and this patch. I'll be working through these over the next week.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Nice to know that parts of pnUserHack will be added in. I think some of it was added in to 726 wasn't it?

    Thanks for the help, again. So, should I put this in as a patch, or what? Since it's a combo patch and module at this point. The client that I'm doing this for felt that it would potentially be a good thing to add back in to the core system. Doesn't matter to me, since this is the same client I wrote the new groups module for and that too more work than I estimated, this ends up a freebie and then some, but both projects are green lighted by him to go back in to the community either added to core or available.

    --
    Home Page | Find on Facebook | Follow on Twitter
  • A few things we're. I'm look after the DUD side of things as this has been broken out into a distinct DynamicUserData module rather than part of the users module. Xiaoyu (class007) is looking after the user aspects.

    For submission I would hold on to the code for the moment (or release it seperately for .726) until .8 is more stable - we're still coding at the moment. Keep me in the loop (send me the code) so that we can attempt to make sure that the only code you need is the module itself.

    I look at this as a good oppurtunity to ensure that we have all the need routes into the core (via APIs etc. ) that you as a developer need to produce your module - a module should stand alone. I'm keen to work with other developers in this fashion to highlight and address any deficiencies in the core code. API compliance is a big step towards this but there are no doubt other areas that can be improved on.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Okay, I have all 3 variables needed (On/Off flag for the function, URL to go to & pnFirstVisit user variable). Here's the modified access_user_login from NS-User/user/access.php

    Code

    function access_user_login($uname, $pass, $url, $rememberme)
    {
       
    /*Begin FirstVisit Mod*/
    if (pnConfigGetVar('pnFirstVisitOn') =='1' AND !pnUserGetVar('FirstVisit')){
     $url = pnConfigGetVar('pnFirstURL');
    }
    /*End FirstVisit Mod*/

        if (pnUserLogIn($uname, $pass, $rememberme)) {
            redirect_index(_LOGGINGYOU, $url);
        } else {
            pnRedirect('user.php?stop=1');
        }
    }

    But it's not working it seems.
  • Michael,

    I'll setup a test and debug this code on a test site later today.

    -Mark

    --
    Visit My homepage and Zikula themes.

Go to page [-1] 1 - 2 - 3 [+1]:

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