How Do I Make a Calculated Custom Field?

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
jmo1121109
Registered User
Posts: 2
Joined: Sun Jan 06, 2019 10:00 pm

How Do I Make a Calculated Custom Field?

Post by jmo1121109 »

Hello,

In my PHPBB forum I have a custom field on the table phpbb_users called webdip_user_id which is automatically filled based on the users ID on the main website we have integrated into the forum. What I am looking to do is have a custom profile field of the URL type that is calculated and non editable to the user to http://webdiplomacy.net/profile.php?userID= + (value of webdip_user_id) so http://webdiplomacy.net/profile.php?userID=1 as an example. I am not seeing any clean way to do this automatically without user input, but my phpbb knowledge is very limited so apologies if I am missing something obvious!
User avatar
Toxyy
Registered User
Posts: 942
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

Re: How Do I Make a Calculated Custom Field?

Post by Toxyy »

This is more of an external page question, but try using $_GET['userID']; or $_REQUEST['userID']; in your php page.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

Some of my extensions:
[3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
jmo1121109
Registered User
Posts: 2
Joined: Sun Jan 06, 2019 10:00 pm

Re: How Do I Make a Calculated Custom Field?

Post by jmo1121109 »

Oh sorry about that. I can repost in a different area if that would be better?

The field webdip_user_id is a custom added field to the phpbb_users table so the table has the normal user_id column, but then also the webdip_user_id. I see that in the acp you can add a new custom field without code changes, is there any possible way to automatically calculate the default value there to reference the webdip_user_id field? You can use %s to allow the user to append a value, so I was hoping there was a way to do the same without a user selection if that makes sense?

+--------------------------+-----------------------+------+-----+-----------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------------+-----------------------+------+-----+-----------+----------------+
| user_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| webdip_user_id | int(10) unsigned | YES | MUL | NULL | |
+--------------------------+-----------------------+------+-----+-----------+----------------+
Post Reply

Return to “phpBB Custom Coding”