We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44491
    • 8 Posts
    Hello ModX community!

    I'm creating a project with two user groups and I need to give them different profile types for example at user group1 in need fields like "city, avatar, about me, skills" and for group2 I need profile fields like "Home town, latest life achievements, life goals" can this be done or if not is there an example of how to code something like this?

      • 42562
      • 1,145 Posts
      That is possible and very easy indeed.
      http://rtfm.modx.com/display/ADDON/Login.Using+Custom+Fields

      One method. Have each group register through its respective page (register1.html, register2.html)
      Each register page will have the required fields, and register them.

      Or, when they are members, have two updateprofile pages (updateprofile1.html, updateprofile2.html) - or have one page with an if/else PHP switch in it checking member group and so forth.
      These two pages should be locked down with access controls so that one group will never be able to access the updateprofile page that does not belong to it, thus creating fields that are useless to it.

      Making the profile public, would be as easy as pulling up necessary fields for members of whatever group.
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
        • 44491
        • 8 Posts
        Thank You very much!

        I have two last thing to do that I just cant resolve I hope you can help me out

        1) How to call if statements for example "if loged_in" and "if usergroup == user_group1".
        2) With MIGX how do I let certain user groups to post things and show those posts on their profile?
          • 42562
          • 1,145 Posts
          To Check usergroup: put this in snippet and call it in your resources (myMemberChecker)
          if ($modx->user->isMember('FirstGroup') )
          {return $modx->getChunk('Profile1');}
          
          elseif ($modx->user->isMember('Second-Group') )
          {return $modx->getChunk('Profil2');}
          
          else
          {return $modx->getChunk('Not-Logged-In');
          //if the user belongs to neither group, then chances are he is not logged in...unless some of your users don't have a group. I usually toss all members in a primary group.
          //OR just make this resource inaccessible to non-members.
          }
          

          To Check if User is logged into this Context: Place in Snippet, and call it (checkLoggedin)
          if ($modx->user->isAuthenticated('web')) 
          {return $modx->getChunk('members');}
          //or {echo "Hello there member";}
            
          else 
          {return $modx->getChunk('notLoggedin');}
          //or {echo "Please log in or register";}
          

          OR
          [[!+modx.user.id:is=`0`:then=`Not a member yet? Please register`]]

          For your second question....

          You want this profile to be viewed by others (public profile)?
          Using MIGX, you are no longer inputting info into profile extended fields.
          You'll have to use a resource for each member. Each member will be able to edit this resource using what and where? Frontend or Backend?

          Please explain.
            TinymceWrapper: Complete back/frontend content solution.
            Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
            5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
            • 13428 ☆ A M B ☆
            • 1,031 Posts
            @donshakespeare: This forum is for Evo development and your code is for Revo. Maybe Zoltan is looking for a Revo solution, but then the thread should be moved.
              • 42562
              • 1,145 Posts
              Ah yes, precisely so... one of those things that fall into my blind spot.
              Zoltan, Jako is correct.
                TinymceWrapper: Complete back/frontend content solution.
                Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                • 13428 ☆ A M B ☆
                • 1,031 Posts
                But Zoltan was the first one who was talking about MIGX, and there is no MIGX for Evo.
                  • 44491
                  • 8 Posts
                  Thank you!

                  The migx thing was a side question because I'm using it to list some user submitted data and i would like to have a connection between modx login and migx.. And I am using MODX Revolution 2.2.8-pl (traditional)