Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
User avatar
durangod
Registered User
Posts: 804
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by durangod »

Hi,

I set up some custom profile fields and i have some questions/concerns.

Here are the fields:
Apache Version: 2.4.58
Server Panel Name And Version: cPanel 110.0.12
Server OS And Version: Linuxx 86_64
MySQL Version: 10.6.16-MariaDB-cll-lve-log
Kernel Version: 2.6.32-954.3.5.lve1.4.93.el6.x86_64
PHP Version: 8.1.27
Browsers And Versions: Chrome 122.0.6261.95 Firefox 123.064-bit
My first concern is about the field validation input.
I originally had it set to (Any letters, numbers, comma, dots, underscores, and dashes beginning with any letter)

I also originally had "V" or "Version" in the text first to meet the input validate requirement.

I thought that would work for that data, however the spaces screwed me up, it would not validate because there are spaces in the text. There is no option that has all those items and includes spaces, there are options that have spaces but they wont work for my data.

So i changed all of them to verify as (any character) which is not what i want.

Seems what i need is what i had originally but with spacers (Any letters, numbers, comma, dots, underscores, spacers, and dashes beginning with any letter). Is that correct, im guessing spacers is actually spaces?

-------------------------------
Second question:

Those fields are dangerous to display to the public especially if im admin or a moderator or owner and list a website as well. So i am trying to set this up so that the custom fields can only be seen by the owner, admin, or moderators. There is no reason that other members should see them.
(owner so they can edit them if needed)
(admin and moderator because we need to know their environment for support reasons)

So far i played with the custom fields config settings as well as the load settings (general tab) and i also did not see any permissions that could assist me.

So it looks like the best i can do with regards to fields display is to enable display on registration and then use the hide feature in the custom fields config. This will allow the user to input the data via registration page, but after that they will never see it, only admin and mods will, and any changes admin or mods will need to do it. Not what i want but not sure what i can do at this point.

Any suggestions?
Might this be a suggested inclusion for the next version?

Thanks :)
Username is short for durango dave
User avatar
durangod
Registered User
Posts: 804
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by durangod »

It also appears that the validation regex may be wrong in phpbb. I tested the regex and some of the data passed on the tester.

some data tested using html form option * (Any letters, numbers, comma, dots, underscores, and dashes beginning with any letter):

regex

Code: Select all

[\p{Lu}\p{Ll}][\p{Lu}\p{Ll}0-9.,\-_]+
test data (with and without spaces):

IMPORTANT: only items marked with * have test form option above, all others are set to (any character)

Version 2.4.58
* cPanel 110.0.12
Linux 86_64
Version 10.6.16-MariaDB-cll-lve-log
version 2.6.32-954.3.5.lve1.4.93.el6.x86_64
* Version 8.1.27
* Chrome 122.0.6261.95 Firefox 123.064-bit

results:
regextest.jpg

however on the user profile page the result is:
custom_profile_field_errors.jpg

So it looks like its failing on spaces.

so adding \x20 seems to take care of the spaces

Code: Select all

[\p{Lu}\p{Ll}][\p{Lu}\p{Ll}0-9.,\-_\x20]+
IMPORTANT: be warned that if you change the table field data to this new regex, the option on the form will change to (any character), i have yet to find the location of this code.

regextest_final.jpg
You do not have the required permissions to view the files attached to this post.
Username is short for durango dave
dgkulick
Registered User
Posts: 70
Joined: Tue Jan 30, 2024 9:48 pm

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by dgkulick »

I can't help on this but I'm following because I'm using an optional profile field and I don't even see where you're getting to validate it. Are you modifying the code?
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6296
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by thecoalman »

durangod wrote: Sat Mar 02, 2024 7:16 am Second question:
Unless I'm missing something here checking "Display in user control panel" and hiding the fields should accomplish what you want.
durangod wrote: Sat Mar 02, 2024 11:00 pm It also appears that the validation regex may be wrong in phpbb.
If you think you have found a bug it can be reported to the bug tracker. Link for the tracker can also be found in the drop down menu under development in the header menu.

http://tracker.phpbb.com/
durangod wrote: Sat Mar 02, 2024 7:16 am Might this be a suggested inclusion for the next version?
In the bug tracker you can label it as improvement. For non existent features or major improvements you can make suggestions in the Ideas section.

viewforum.php?f=436

Lastly for custom coding those topics should be posted in the custom coding section.

viewforum.php?f=641
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
durangod
Registered User
Posts: 804
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by durangod »

Thanks for the info :) It was originally just a question and i thought support was the right place for it, but then it became something more. Yeah if i would have known it was going to grow into something much more detailed i would have put it in custom coding, live and learn ya know. :)

Great links thanks so much. I need to finish my research so i have a full understanding of what i am dealing with before i push it forward as a bug or other outcome... :)
Username is short for durango dave
User avatar
durangod
Registered User
Posts: 804
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by durangod »

dgkulick wrote: Sun Mar 03, 2024 1:04 pm I can't help on this but I'm following because I'm using an optional profile field and I don't even see where you're getting to validate it. Are you modifying the code?
Hi, when you edit a custom profile field, on the first page of the edit page there is a button on the very bottom that reads Profile type specific options.

Click that button and you will see the config option for Field validation. Its a drop down menu with lots of choices. Which ever choice you make controls the regex that is written to the table, you wont see the regex unless you look at the table. Yes i am playing around with the DB table contents.

I do not recommend changing anything in the table as i have in my research as its causing unexpected results that i am finding here and there. I have alot of experience in doing this and make backups all the time.

Does that answer your question, if not let me know :)
Username is short for durango dave
User avatar
durangod
Registered User
Posts: 804
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by durangod »

thecoalman wrote: Sun Mar 03, 2024 4:44 pm Unless I'm missing something here checking "Display in user control panel" and hiding the fields should accomplish what you want.
I tested this earlier this week, the problem is that there is no specific permission (in permissions) to allow on the owner to see the information. So that means that as a guest when i look at someones profile i can see the data. And using the hide feature hides it from everyone other than admin and moderators.

Also tested the load options and it works the same.

So it appears what is needed is to change the hide config to allow owner as well, add a config for "show owner", or add a permission for "allow owner to view their own custom fields"

This information is not good to show others, if someone has a website listed in their profile as well as all of this information, it gives alot of sensitive information that could be used against them on their site. So it only needs to be viewed by the Owner, Admin, Moderator (and not just any moderator maybe a global moderator level)

So maybe user permission based, but that wont work because then it would have to be set per user. Thats fine for admin and global mod but not for owner as there are many. So maybe permissions is not the right way as there is really no way i can think of to handle it all with one permission addition (regardless if user, group, forum...) So i think a config would do the trick.

Im going to test this more to be sure its not already possible via some config magic mix :)
Username is short for durango dave
dgkulick
Registered User
Posts: 70
Joined: Tue Jan 30, 2024 9:48 pm

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by dgkulick »

durangod wrote: Sun Mar 03, 2024 8:44 pm
dgkulick wrote: Sun Mar 03, 2024 1:04 pm I can't help on this but I'm following because I'm using an optional profile field and I don't even see where you're getting to validate it. Are you modifying the code?
Hi, when you edit a custom profile field, on the first page of the edit page there is a button on the very bottom that reads Profile type specific options.

Click that button and you will see the config option for Field validation. Its a drop down menu with lots of choices. Which ever choice you make controls the regex that is written to the table, you wont see the regex unless you look at the table. Yes i am playing around with the DB table contents.

I do not recommend changing anything in the table as i have in my research as its causing unexpected results that i am finding here and there. I have alot of experience in doing this and make backups all the time.

Does that answer your question, if not let me know :)
Ha, I looked and still didn't see it. A cat was blocking the lower right side of the screen. Thanks. It won't work for me since I need that to be an address in my community. I suppose I could write code to compare it to a list of all the addresses, but even then I'd need to use something like websites do to recommend an alternative format of the address. Nope, registration is going to have to be admin approved. That's mostly why I'm dumping a few thousand users into the database before going live.
User avatar
durangod
Registered User
Posts: 804
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by durangod »

dgkulick wrote: Mon Mar 04, 2024 12:14 am Ha, I looked and still didn't see it. A cat was blocking the lower right side of the screen. Thanks. It won't work for me since I need that to be an address in my community. I suppose I could write code to compare it to a list of all the addresses, but even then I'd need to use something like websites do to recommend an alternative format of the address. Nope, registration is going to have to be admin approved. That's mostly why I'm dumping a few thousand users into the database before going live.
So basically you are seeking a regex for a location address, is that correct? If so and you are not in the USA what is the format for the address there?
If not please explain, maybe i can help you find something that will work as long as it does not stray away from this topic subject.
Username is short for durango dave
User avatar
durangod
Registered User
Posts: 804
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

Re: Custom Profile Fields Validation and Viewable only by Owner, Admin, Moderators

Post by durangod »

Here is the custom coding link for this change i did

viewtopic.php?t=2651584

Now to test out some config options for the owner view. :) ill be back...
Username is short for durango dave

Return to “[3.3.x] Support Forum”