We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46580
    • 167 Posts
    I would like to use lexicon in combination with placeholders, like this :

    [[%kai.[[+itchikai_tab]]? &namespace=`doodles`]]

    But, output : kai.hidden (the lexicon entry name), corresponding lexicon string is not processed.

    I'd like to use it in a multilanguage select list, [[+itchikai_tab]] is an extended user field value.
    The idea is to get "readable" lang. string instead a 'raw' or a binary value in the list.

    		<select id="itchikai_tab" name="itchikai_tab" class="selectpicker" data-width="100%">
    			<option selected>[[%kai.[[+itchikai_tab]]? &namespace=`doodles`]] </option>
    			<option value="botleft">Bas / gauche</option>
    			<option value="botright">Bas / droite</option>
    			<option value="hidden">Invisible</option>
    		  </select>



    Then I tried with the following valToLex snippet:

    [[valToLex? &var=`[[+itchikai_tab]]`]]

    $modx->lexicon->load('doodles:default');
    return $modx->lexicon('kai.'.$var);
    


    But it also returns 'kai.hidden' (lexicon entry name), not the corresponding string...

    Any idea? [ed. note: johnxx last edited this post 12 years, 1 month ago.]
      MODX lover
      -
      Développeur MODX / Webdesign / Solutions web
      • 46580
      • 167 Posts
      ... found the beginning of a solution with this snippet:

      $modx->lexicon->load('doodles:default');
      $plvar = $modx->getPlaceholder($var);
      $lexentryname = 'kai.'.$plvar;
      return $modx->lexicon($lexentryname);


      But extended user fields (classExtender) are not updated... it works but with 'native' extended user fields not with classExtender, even for placeholders, it's not the classExtender placeholders, but modx 'native' extended user fields. [ed. note: johnxx last edited this post 12 years, 1 month ago.]
        MODX lover
        -
        Développeur MODX / Webdesign / Solutions web
        • 3749
        • 24,544 Posts
        Did you try putting one of these above your select code (depending on which object you're extending)?

        [[+SetUserPlaceholders]]

        [[+SetResourcePlaceholders]]
          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
          • 46580
          • 167 Posts
          Quote from: BobRay at Aug 06, 2014, 06:22 PM
          Did you try putting one of these above your select code (depending on which object you're extending)?

          [[+SetUserPlaceholders]]

          [[+SetResourcePlaceholders]]

          I added
          [[!UpdateProfile? &validate=`fullname:required,email:required:email`]]
          [[!SetUserPlaceholders]]
          [[!ExtUserUpdateProfile]]

          and updated ExtUserUpdateProfile snippet with my own extended fields ($fields = array()...) : front end forms still to work with 'native extended user fields' (modx 2.3).

          Also tried with:
          [[!UpdateProfile? &useExtended=`0` &validate=`fullname:required,email:required:email`]]


          [[!SetUserPlaceholders]] > ok, form get right 'classExtender' fields
          [[!ExtUserUpdateProfile]]

          and :
          [[!UpdateProfile? &postHooks=`ExtUserUpdateProfile` &useExtended=`0` &validate=`fullname:required,email:required:email`]]

          [[!SetUserPlaceholders]] > ok, form get right 'classExtender' fields

          Native Extended field : not updated (as expected with &useExtended=`0`)
          classExtender fields placeholders : ok
          classExtender fields update : no

          Maybe i don't use correctly ExtUserUpdateProfile snippet or I have to update something in the snippet code?

          [ed. note: johnxx last edited this post 12 years, 1 month ago.]
            MODX lover
            -
            Développeur MODX / Webdesign / Solutions web
            • 3749
            • 24,544 Posts
            Yes, the ExtUserUpdateProfile snippet is just an example from a site I created. It has the field names hard-coded in it as well as the submit-var for the form (set as 'login-updprof-btn' at the top of the snippet). You'd have to correct those for it to work.

            You should be able to use &useExtended=`1` if there are standard extended fields in the User Profile without causing any trouble.

            The next release of ClassExtender will have a more generic version of ExtUserUpdateProfile.
              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
              • 46580
              • 167 Posts
              Thanks for your reply.

              Do you think it could be something to do with the following error log ?

              [2014-08-08 16:54:01] (ERROR @ /index.php) Path specified for package extendeduser is not a valid or accessible directory: /var/www/clients/client3/web12/web/core/components/classextender/model/model/
                MODX lover
                -
                Développeur MODX / Webdesign / Solutions web
                • 3749
                • 24,544 Posts
                Yes, possibly.

                Is this MOD 2.3? I've seen that reported before but I can't duplicate it. I don't know what could cause it.

                If it's MODX 2.3, you might look in the database at the modx_extension_packages and see what the path is there.

                  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
                  • 46580
                  • 167 Posts
                  Quote from: BobRay at Aug 08, 2014, 05:20 PM
                  Yes, possibly.

                  Is this MOD 2.3? I've seen that reported before but I can't duplicate it. I don't know what could cause it.

                  If it's MODX 2.3, you might look in the database at the modx_extension_packages and see what the path is there.


                  extendeduser path is not defined in modx_extension_packages table.



                  Also not defined for others (gallery, collections). When I try to add the path I cannot login in the manager.

                  Modx setting for extension_packages are:

                  {"1":{"gallery":{"path":"[[++core_path]]components/gallery/model/"}},"2":{"collections":{"path":"[[++core_path]]components/collections/model/"}},"3":{"extendeduser":{"tablePrefix":"ext_","path":"[[++core_path]]components/classextender/model/"}},"4":{"articles":{"path":"[[++core_path]]components/articles/model/"}}} [ed. note: johnxx last edited this post 12 years, 1 month ago.]
                    MODX lover
                    -
                    Développeur MODX / Webdesign / Solutions web
                    • 3749
                    • 24,544 Posts
                    Interesting. I have this for the extension_packages setting:

                    [{"extendedresource":{"tablePrefix":"ext_","path":"[[++core_path]]components/classextender/model/"}},{"extendeduser":{"tablePrefix":"ext_","path":"[[++core_path]]components/classextender/model/"}}]


                    It looks exactly like yours but without the index numbers. I don't know why that would be, but it shouldn't make any difference. I'm also running MODX 2.3.1. It also doesn't make any sense that you're not getting that error for the other extension packages.

                    I don't have anything at all in the modx_extension_packages table. Again, I don't know why you do and I don't.

                    Two things to try (do just the first one at first):

                    1. Edit the extendeduser namespace (Gear Icon -> Namespaces). Remove the model/ from the end of the core path field (so it would be: {core_path}components/classextender/). Be sure it ends in a slash.


                    2. Remove the extendeduser record in the modx_extension_packages table (but make a note of the fields so you can put it back).






                      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
                      • 46580
                      • 167 Posts
                      no changes. I'll try an alternative way to save classExtender extended user fields from a front-end form, maybe following your "Custom Database Tables" guide (http://bobsguides.com/custom-db-tables.html).
                        MODX lover
                        -
                        Développeur MODX / Webdesign / Solutions web