We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46886
    • 1,154 Posts
    Ok, I am back and am going to solve this problem. Its quite a mess right now. I want this info to be provided in the profile page of each user.

    The default template of Discuss seems to have a problem in that it doesn't provide the value of registration date in the profile, on my install there is no output at all.

    After some searching and experimentation I decided not to even look at this as a Discuss problem, because the Login package handles user registration. The date of registration of a user should be recorded by Login. There should be no need to deal with how Discuss might handle this data as Login should do it for us.

    So far I have tried many values such as [[*createdon]] and [[*publishedon]], to no avail. So I will ask my friend to make a custom snippet. I know the data must be there, so its just a matter of calling for it and displaying it.

    Can anyone give some suggestions on this? Any advice would be welcome.

    This question has been answered by BobRay. See the first response.

      • 46886
      • 1,154 Posts
      Ok it turns out that the register date is not set at all! That's a bit surprising to me. Actually BobRay told me that a long time ago, but I forgot about it.

      Whitebyte gave me a solution, I will implement it soon. Then I will ask my friend to build a custom snippet to go into the db, get this value for a user, and display it on the profile page and probably in every post by that user.

      In my mind the registration date is an important value as it lets other users know sort of how much they can trust another user...maybe this isn't important but it seems to be in my thinking.

      Here is the solution to creating the value in the registration code:

      http://forums.modx.com/thread/95745/how-to-add-registration-date

        • 49529
        • 196 Posts
        nuan88, i suppose most of functionality you need is already implemented in Login extra. Just take a look at the docs - http://rtfm.modx.com/extras/revo/login. Login extra ships with a bunch of useful snippets (e.g. Profile snippet), a you should probably use them to avoid reinventing the wheel. For example, you don't need any custom snippets to get user profile data from DB, just use mentioned Profile snippet.
          • 3749
          • 24,544 Posts
          Quote from: nuan88 at Jan 12, 2015, 01:38 AM
          Ok it turns out that the register date is not set at all! That's a bit surprising to me. Actually BobRay told me that a long time ago, but I forgot about it.

          If it makes you feel any better, I forgot about it too. wink
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 46886
            • 1,154 Posts
            Heh BobRay, I am sure you have forgotten better things than this little detail. Forgotten to eat, ever? Go ahead, admit it ;-)

            I was going through my old posts and found it, I swear I never internalized that info, must have gotten distracted.

            Whitebyte, thanks for the help, I am using the profile in Discuss, which isn't really different I guess. I think I have had some trouble to understand the difference between the two.

            The Discuss profile lacks much info, as most of the options were either missing or not important (fax number anyone). So I have been wanting to fill it up a bit. I don't think I even knew that Login had its own profile. Will have to look at that more closely.
              • 3749
              • 24,544 Posts
              @nuan88 wink

              Doesn't Discuss automatically store the user's registration date in its own disuser table ( or some other custom table)? It won't be available through the regular Profile snippet, but Discuss's Profile should set it as a placeholder.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 46886
                • 1,154 Posts
                Hi BobRay:

                Ha, your question really made me laugh. This is just the info I have been searching for for some time now haha. Round and round we go...

                Whitebyte makes the point that *Login* does not store this data, and has provided a work-around, a custom snippet.

                Discuss's profile includes a place where this info is supposed to appear, and originally I thought it was just the code to get it which was the problem, however over time it began to appear that perhaps the value isn't being stored by Discuss at all.

                The code which was intended to get the date of user registration is this:

                <div class="f1-f2">[[%discuss.date_registered]]: </div>
                <div class="f3-f5">[[+createdon:strtotime:date=`%b %d, %Y`]]</div>


                Using the plus sign is typical Discuss code, that template is full of [+posts] and other things.

                Anyway, I am going to go back through some old messages, I remember you provided a quick tool that would go into the db and get some info...I forget exactly, but it seems like it could be useful now. I didn't try it at the time, probably got distracted.

                This +createdon is presumably the value in the db, at least that was the intention. Whether the notation is correct or the value is stored is another question.

                Just to be clear and hopefully comprehensive, the standard register template for discuss as provided in the documentation has no reference or anything to date registered, if its in there it should be an automatic function of Discuss.

                I will report back, I can find that tool this weekend and post it here, I do want to try out some things. But, with Whitebyte's tool, that might be a faster way to fix this situation and move on, so I don't think I will put too much time in this issue if there is another way to get the output I want.
                  • 46886
                  • 1,154 Posts
                  Ok here is the code from BobRay that might give me some useful info:

                  Discuss extends the modUser object and adds some extra fields. That field is, in fact, called 'createdon', but you won't get it with the standard created on tag (which gets the Resource createdon field).

                  You might try this snippet and see if you get anything:
                  $userId = 12; // set this to the ID of a registered Discuss User
                  $usr = $modx->getObject('disUser', array('user' => $userId));
                  if ($usr) {
                      return $usr->get('createdon');
                  } else {
                      return 'User Not Found';
                  }


                  The Discuss schema is kind of funky (and you have to go to GitHub to see it), so I'm not sure if this is right.

                  I also saw a post recently that looked useful, it seemed to be able to get profile data using terms something like [profile:createdon]

                  Will add that here soon.
                    • 3749
                    • 24,544 Posts
                    I remembered that I have a localhost site installed that still has Discuss tables in the DB.

                    There *is* a createdon field and it does hold the user's registration date, though it's not set for all the members I have (there are only three). There is also a confirmedon field.

                    Discuss should set the placeholders for all the fields, so either of these placeholders should work (in theory):

                    [[+createdon]]
                    [[+confirmedon]]


                    You might get a unix timestamp (just a number) or a readable date. Either way it can be formatted the way you want to display the date.





                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 46886
                      • 1,154 Posts
                      In the Discuss profile, where all the good stuff like [[+posts]] and [[+last_active]] display info, these two values do not return anything.

                      I just checked with 6-7 users, not one profile has either createdon or confirmedon returned, the spaces are simply blank. Its weird because the discuss db must or should be loaded as the other values are returned. I am ready to stick a fork in this haha.

                      Thanks for all your help BobRay. Given that there is a workaround, we might want to let this issue go finally.