Announcement

Collapse
No announcement yet.

Hide a custom profile field from usergroups

Collapse
X
Collapse
First Prev Next Last
  • Filter
  • Time
  • Show
Clear All
new posts

    Hide a custom profile field from usergroups

    Hi,

    Using Vb 5.4.2 (if that make any difference).

    I'm looking for a way to hide a custom profile field from certain user groups.
    The purpose of this function would be to allow moderators and admin to add a note on a member.
    Currently I can only hide a custom profile field to the other users but I didn't find a way to hide this profile field from the user itself.

    I saw some interesting leads that are css based (a thread to hide the Last activity namely) but I'm not sure about that solution as it seems to me that a simple hop in the developer console could turn the visibility "on" again.
    I saw also a very old thread on google to achieve such a function but it was for vB 3.7 if I remember, and since the plugin system doesn't exist/work the same way now, I'm a bit lost

    Is there a not too complicated way to achieve such functionality ?

    Cheers and thanks in advance for the help

    #2
    So you want to add a note to a user via custom profile field but you don't want the user to see it?

    Comment


      #3
      I created a bug-tracker for that a while ago...
      Also I created a mod to allow admin and mods to create user-notes. Will be released soon!
      Release-preview: https://vbulletin-forum.de/forum/eng...elease-preview
      vBulletin-Forum.de Das deutschsprachige vBulletin 5 Forum! | Widgets, Free & Exclusive Mods and Tutorials.
      You will find a lot of good stuff here!

      Comment


        #4
        Originally posted by glennrocksvb View Post
        So you want to add a note to a user via custom profile field but you don't want the user to see it?
        Exactly, I figured using custom profile field would be the easiest way to find a work around, as this would not require a lot of custom coding for the note itself, just to find how to hide it from the user itself.
        Do you have any idea on that ?
        Thanks !

        Originally posted by delicjous View Post
        I created a bug-tracker for that a while ago...
        Also I created a mod to allow admin and mods to create user-notes. Will be released soon!
        Release-preview: https://vbulletin-forum.de/forum/eng...elease-preview
        Great mod in perspective !

        Comment


          #5
          If it could be of any help for this, that was the previous proposed solution on an older version of Vb :
          https://forums.digitalpoint.com/thre...#post-17583093

          Any idea how to implement the same trick into Vb 5 ?

          Thanks a lot

          Comment


            #6
            Is the first suggested solution to set "Can View Hidden User Profile Fields" permission to No not enough for your needs?

            Comment


              #7
              Originally posted by glennrocksvb View Post
              Is the first suggested solution to set "Can View Hidden User Profile Fields" permission to No not enough for your needs?
              Thanks for the answer

              As I said in my first post, unfortunately, this function doesn't hide the profile field to the concerned user, only to the other users that have this permission switched off.
              The user itself will still see the field when he goes to consult his own public profile (with or without the ability to modify said field, that doesn't change the viewing permission unfortunately).

              Do you have any idea on how to achieve that ? The link I posted was offering a very simple solution, unfortunately my abilities in Vb5 doesn't allow me to convert it easily

              Comment


                #8
                I'l check if solution #2 is possible in vB5.

                Comment


                  #9
                  Originally posted by glennrocksvb View Post
                  I'l check if solution #2 is possible in vB5.
                  Thank you very much for that ! I'm a bit lost and not the best coder in the world but I'm willing to put some efforts into that If I can gather the right guidance
                  Thanks again !

                  Comment


                    #10
                    Hi glennrocksvb was wondering if you had time to take a quick look at this question, I'm not looking for a ready to go solution, but just a bit of guidance on how to start with that if you can and have time

                    Cheers

                    Comment


                    • glennrocksvb
                      glennrocksvb commented
                      Editing a comment
                      I didn't have time to take a look yet.

                    #11
                    Little heads up on that subject :

                    I've found a way of doing what I want, meaning : hiding custom fields from certain usergroup (everyone except staff members).
                    This technique will need some tweaking if you want to hide a specific field from some usergroup, I wanted to hide all custom fields as they are not used for anything else.

                    To do that you have to edit your template (each one of them -as long as they are used-) and edit the profile_about one.
                    Locate the line that starts like that :
                    Code:
                    <vb:each from="userInfo.customFields" key="category" value="fields">
                    Under this line :
                    Code:
                    <vb:if condition="$category != 'default'">
                    Add the following code :
                    Code:
                    <vb:if condition="$bbuserinfo['usergroupid'] == '7' OR '6'">
                    The 7 or 6 numbers are the usergroup ID, those are the ones authorised to view custom profile fields.

                    After this set of lines :
                    Code:
                    <div class="td">{vb:raw field.val}</div>
                                        </div>
                                    </vb:if>
                                    </vb:each>
                                </div>
                    Add the if statement closing tag :
                    Code:
                    </vb:if>
                    Then you only have to create your custom profile field and they will only show to the usergroup you selected.

                    This method is not very pretty nor easy to maintain, but it works well for my purpose.

                    Comment


                      #12
                      Originally posted by Glaudiar View Post
                      This method is not very pretty nor easy to maintain
                      You are right. This will likely cause template merge conflicts you'll have to resolve whenever you upgrade.

                      Comment

                      Working...
                      X