HomeHome  
  • WelcomeWelcome  
  • Events  
  • PublicationsPublications  
  • FAQFAQ  
  • SearchSearch  
  • MemberlistMemberlist  
  • UsergroupsUsergroups  
  • RegisterRegister  
  • Log inLog in  
  • You are not connected. Please login or register


    Memberlist Help #1

    avatar
    • ***


        Reputation : 1
        Registered on : 2013-08-31
        Posts : 26
        LG
      How would I go about adding custom profile fields to the memberlist? It's a well asked question on Forumotion's help boards, but its never really explained how to do it. And im not referencing altering "Humor" or something along those lines. 


      I can see the profile field ID's. You can see that code needed is generated on the Profile page where it has all your profile fields.

      This code is listed at the bottom of that page and I think it helps generate what I want, but I know nothing of Javascript. 



      Code:
      //<![CDATA[
         $(document).ready(function(){
            $('[id^=field_id]').each(function(){
               if ( $(this).find('.field_editable').is('span, div') )
               {
                  $(this).hover(function()
                  {
                     if( $(this).find('.field_editable.invisible').is('span, div') )
                     {
                        $(this).find('.field_editable').prev().addClass('ajax-profil_hover').parent().addClass('ajax-profil_parent').append('<div class="ajax-profil_edit"><img src="{AJAX_EDIT_IMG}" /></div>');
                        $(this).find('.ajax-profil_edit').attr({
                              alt: "{L_FIELD_EDIT_VALUE}",
                              title: "{L_FIELD_EDIT_VALUE}"
                           }).click(function(){
                           $(this).prev().prev().removeClass('ajax-profil_hover').addClass('invisible').next().removeClass('invisible').append('<img src="{AJAX_VALID_IMG}" class="ajax-profil_valid" />').find('input,select');
                           $(this).prev().find('.ajax-profil_valid').attr({
                              alt: "{L_VALIDATE}",
                              title: "{L_VALIDATE}"
                           }).click(function(){
                              var content = new Array();
                              $(this).parent().find('[name]').each(function(){
                                 var type_special = $(this).is('input[type=radio],input[type=checkbox]');
                                 if ( (type_special && $(this).is(':checked')) || !type_special )
                                 {
                                    content.push(new Array($(this).attr('name'), $(this).attr('value')));
                                 }
                              });
                              var id_name = $(this).parents('[id^=field_id]').attr('id');
                              var id = id_name.substring(8, id_name.length);
                              $.post(
                                 "{U_AJAX_PROFILE}",
                                 {id:id,user:"{CUR_USER_ID}",active:"{CUR_USER_ACTIVE}",content:$.toJSON(content),tid:"{TID}"},
                                 function(data){
                                    $.each(data, function(i, item){
                                       $('[id=field_id' + i + ']').find('.field_uneditable').html(item).end().find('.ajax-profil_valid').remove().end().find('.field_editable').addClass('invisible').end().find('.field_uneditable').removeClass('invisible');
                                    });
                                 },
                                 "json"
                              );
                           });
                           $(this).remove();
                        });
                     }
                  },function()
                  {
                     if( $(this).find('.field_editable.invisible').is('span, div') )
                     {
                        $(this).find('.field_editable').prev().removeClass('ajax-profil_hover');
                        $(this).find('.ajax-profil_edit').remove();
                     }
                  });
               }
            });
         });
      //]]>


      I've asked this elsewhere, but it never really was answered for me. :/ 
      Thanks for your help with this!

      avatar
      • Administrator

          Reputation : 315
          Registered on : 2012-02-22
          Posts : 2317
          School of codes courses: coming soon
        Hello,

        sorry but actually I didn't get the problem :(

        can you explain it better?



        Niko wants you in the team Guest

        Community manager and Administrator at Forumattivo.com

        avatar
        • ***


            Reputation : 1
            Registered on : 2013-08-31
            Posts : 26
            LG
          On the Memberlist page (/memberlist) it only displays a certain set of profile fields (which would be "Last Visit" "Join Date" "Humor" "Posts" "Website" "Avatar"). I wanted to add a custom field I created. 

          For example lets say I created a filed called "Favorite Game" and then I provide a list of games for my user's to choose from. I want to display that "Favorite Game" section on my member's list page.

          Like I mentioned in my first post, its been talked about in the help section of forumotion's site.. but nothing was ever discussed on how it's done. I provided the Java code, because that is what is used on the "PROFILE" page that displays all custom fields.

          avatar
          • Administrator

              Reputation : 315
              Registered on : 2012-02-22
              Posts : 2317
              School of codes courses: coming soon
            so, you want to have a customized field in the memberlist page...

            actually I think that cannot be done, as the variables used for Forumotion fields are:
            Code:
            <th class="number">#</th>
                  <th class="name">{L_AVATAR} - {L_USERNAME}</th>
                  <!-- BEGIN switch_th_group -->
                     <th class="group">{L_GROUPS}</th>
                  <!-- END switch_th_group -->
                  <th class="interests">{L_INTERESTS}</th>
                  <th class="joined">{L_JOINED}</th>
                  <th class="active">{L_VISITED}</th>
                  <th class="posts">{L_POSTS}</th>
                  <th class="pm">{L_PM}</th>
                  <th class="website">{L_WEBSITE}</th>

            and there isn't an extra one like
            Code:
            {L_MYFIELD}



            Niko wants you in the team Guest

            Community manager and Administrator at Forumattivo.com

            avatar
            • ***


                Reputation : 1
                Registered on : 2013-08-31
                Posts : 26
                LG
              I'm not 100% sure, but I'm at least 90% sure you can add extra fields via JavaScript. While you won't be able to do it with variables, I'm fairly positive the results can be achieved via JavaScript.  For each customized field you create, a field id is assigned to it. I'm not sure how to make the code myself, but I guess iI should start learning JavaScript lol.

              avatar
              • Administrator

                  Reputation : 315
                  Registered on : 2012-02-22
                  Posts : 2317
                  School of codes courses: coming soon
                actually if you have 2000 users the js code would load 2000 pages, would extract 2000 fields

                and I don't suggest it.. that you will be too much for your browser



                Niko wants you in the team Guest

                Community manager and Administrator at Forumattivo.com

                avatar
                • ***


                    Reputation : 1
                    Registered on : 2013-08-31
                    Posts : 26
                    LG
                  Ah okay. That makes sense. Hmm.. Maybe forumotion isn't the best platform for what I want to accomplish. 

                  Thanks

                  avatar
                  • Administrator

                      Reputation : 315
                      Registered on : 2012-02-22
                      Posts : 2317
                      School of codes courses: coming soon
                    actually to have what you are asking for, a modification in the php code should be done

                    but it isn't possible on forumotion :bene:



                    Niko wants you in the team Guest

                    Community manager and Administrator at Forumattivo.com

                    avatar
                    • ***


                        Reputation : 1
                        Registered on : 2013-08-31
                        Posts : 26
                        LG
                      Ok. I suppose that all makes sense. Was going to ask about Filtering Memberlist as well instead of Sorting, but it will do the same thing. It will have to request thousands of things.

                      Maybe instead of a memberlist, I can create threads. I can use one of the many form to thread tutorials floating around and have my site auto-create a thread based on info I ask from user's. Then I can add a custom search in that section's topiclist in order to filter the results like I would want to do via Memberlist.

                      It all sounds complicated but i'll have a go at that lol.

                      avatar
                      • ***


                          Reputation : 1
                          Registered on : 2013-08-31
                          Posts : 26
                          LG
                        This thread can be closed.
                        I am going to create a new one with a brand new issue! lol.

                        Thanks.

                        avatar
                        • Support Moderator

                            Reputation : 8
                            Registered on : 2014-03-11
                            Posts : 299
                            Helping on the forum
                          Hello

                          as this topic is solved it is locked and moved to the sub-section Solved issues

                          Thanks,
                          and hope to see you soon again on fmcodes



                          FMCodes Support Moderator

                          I am very active now! Feel free to PM me anytime.


                          YOUR BANNER HERE
                          728x90
                          DMCA.com Protection Status
                          Forum create on Forumotion | © PunBB | Free forum support | Contact | Report an abuse | Free forum