Change username with first name and surname extracted elsewhere

Discussion forum for Extension Writers regarding Extension Development.
User avatar
axe70
Registered User
Posts: 752
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio
Contact:

Change username with first name and surname extracted elsewhere

Post by axe70 »

Hello all!
Long time ago i seen (i am sure) a specific piece of comment into a file, that i was sure it was includes/functions_display.php and +- it says like this:
this is a good place to change the username
or something like this.
But i see now there is nothing about this, so the file was not this.
What it is the name of this function? Where it is (file) :?
Thank you!

FOUND!
includes/functions_content.php

[EDITED]
Last edited by HiFiKabin on Sun Sep 25, 2022 3:59 pm, edited 1 time in total.
Reason: Moved to Extension Writers Discussion
Do not take me too serious
Anyway i do not like Discourse
User avatar
axe70
Registered User
Posts: 752
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by axe70 »

So, i have take a look into this function and i ask to myself (into an integration scenario view):
how i should pair users to match where there are no ids/usernames matching between cms?
Here there is no email to check against and pair
May with luck it is possible to have same usernames, like the case for the site i did it 3 or 4 years ago (but i am thinking for a solution that will ever work even with mismatching usernames, and also for a better solution since i will have to update this site soon).
Also, unfortunately, there is no unique file to edit or single function to hook into to get the result.
I listed files i edited this time to get the result, and were more than 5, 6 or 7 if not wrong.

Anybody know a better way to do this, and which hooks to get the complete result and have in place of usernames, something else like first name and surname, extracted elsewhere, into the whole frontend?

I know how to do it, but i am searching for a convenient way to do this via extension without loose my mind on searching all about (or i will copy the old procedure).
Any help?

p.s
NOPE:
i will extract in phpBB by email and not by username... what stupid ..... anyway it will require a query more, and remain the question: where it is better to hook to switch usernames in the whole frontend? I did it as said, file by file, into 6 or 7 if not wrong.
Now i want into an extension to release also for free: any idea?

[EDITED]
Do not take me too serious
Anyway i do not like Discourse
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by 3Di »

I am sure I have already answered your question.

Maybe I am wrong because your questions are very complicated, but really very. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
axe70
Registered User
Posts: 752
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by axe70 »

Non me lo ricordo, scusa Marco :?
No non è complicato:
fullNames.png
fullNames.png (11.28 KiB) Viewed 3408 times
I've got the result changing some file, adding on it just on top an instruction that grab data from the linked cms (guarda che scrivo cms e non quel nome cosi non ti incazzi :D ) then where there are loops for topics and posts, a simple foreach assign the right full name on phpBB template vars.
It is very nice result to see.
I will look around in mind how to make it better. The nice would be to have in phpBB by default, two fields on profile, name and surname, not only username, so that users could choose like into the other cms, what kind of name to display on front-end. I never focused this aspect in phpBB, let see for my little knows, what it is possible to do with
Last edited by axe70 on Thu Feb 17, 2022 8:26 am, edited 1 time in total.
Do not take me too serious
Anyway i do not like Discourse
User avatar
axe70
Registered User
Posts: 752
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by axe70 »

I think actually, the best way would be:
(or almost i did like this):
extract usernames from loops on top of files, based on values a query get full usernames into other cms in a single fast query (but based on what? usernames or emails? i want by email now, would be possible? let see...) then where loops assign vars the template vars values are compared and paired.
That is, but now, i want to make it an extension and so, it will be necessary to find hooks where to do the same i did editing 6/7 files: it would be not so hard, anyway, would be awesome to have a single point where would be possible to set a var and get the same result once. Let see...

P.s fields can be created in phpBB. Let see how it can be used and if can be used for the scope

[EDITED][EDITED]
Do not take me too serious
Anyway i do not like Discourse
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by 3Di »

Your CMS does not appear to have a user database field defined in phpBB as "username_clean", this has already been discussed and explained by me previously. So now I'm wondering how you would like to proceed. You can not compare "username", shortly said.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
axe70
Registered User
Posts: 752
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by axe70 »

I hope to find out this:
a place where i can grab all phpBB user's emails of usernames that will display on each front-end page.
It should be reduced to 3 4 events at max i think? may 5 or 6.
Emails need to be collected at 0 cost in phpBB (just an array filled with values during default loops that going to build data for pages)
should be possible to not be constrained to get emails against usernames, because it cost a query. Based on results you could get then data by emails, and pair. Very easy but it cost a query more in phpBB fired before that the query to the other cms is done. And i would really avoid this. This is not reliable because these queries runs each time phpBB loads. It could be tricky to create a txt file or db row on fly once the extension installed, with paired usernames/emails/ids, so included and used to pair usernames, so fast: if value not found, and only in this case, the query to the other cms to check will be done (and values added on file or db updated so next time will not be necessary again)
There are several easy way to get any always the right result, the question is: what it is the best, the faster and reliable?
I want 1 single query or no query at all, if not the first time to fill all data somewhere, or when some record required to be added because not found.
Or as said, only a single fast query at runtime
[EDITED][EDITED]
Last edited by axe70 on Thu Feb 17, 2022 9:12 am, edited 2 times in total.
Do not take me too serious
Anyway i do not like Discourse
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by 3Di »

You always have to choose the safest and reliable one. But as far as I can see this could complicate things, as it could introduce a query for each individual forum or even post.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
axe70
Registered User
Posts: 752
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by axe70 »

It is an easy routine/code, it would be amazing:
It could be tricky to create a txt file or db row once the extension installed, with paired usernames/emails/ids created automatically, so included and used to pair usernames, it is so fast: then after, if value not found, and only in this case, the query to the other cms to check will be done (and values added on file or db updated so next time will not be necessary again)
with this you'll have all the portability, with any and between any cms, that is reliable. Near to 0 cost.

Also a single query at runtime is near to 0 cost if by email and/if do not will require a query more in phpBB before to perform the query to the other cms

[EDITED][EDITED]

i think the best solution would be to associate custom fields in some way... there is another concept :idea: ... let see
Last edited by axe70 on Thu Feb 17, 2022 9:43 am, edited 1 time in total.
Do not take me too serious
Anyway i do not like Discourse
User avatar
axe70
Registered User
Posts: 752
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by axe70 »

The easier and reliable in mind is this.....sorry i do not want to bump this stupid post, i put ideas while i have in mind that are different by ideas on prev posts... so :idea:

In the view of an integration about this, there are two fields required, surname and first name.
These values can be stored as custom profile fields in phpBB.
When the other cms go to fill fields or update, the same will happen into phpBB.
The same will do phpbb if option active, into related cms db fields.
So that, there is no necessity of nothing, but only this.
This is a 0 cost concept.

... And of course ... the way to switch the usernames into phpBB in the right way on each page using related hooks.
It will/would be nice :)


[EDITED]
Do not take me too serious
Anyway i do not like Discourse
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by 3Di »

axe70 wrote: Thu Feb 17, 2022 9:37 am sorry i do not want to bump this stupid post, i put ideas while i have in mind that are different by ideas on prev posts... so
Don't worry, I know you now. Let's say you set up your own topics and make it your own blog. :lol: ;)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
GanstaZ
Registered User
Posts: 1187
Joined: Wed Oct 11, 2017 10:29 pm
Location: GZOverse

Re: Change username with first name and surname extracted elsewhere

Post by GanstaZ »

I don't know about 0 cost as to me it seems that it will cost more than 0. One thing i can say, it is totally based on my view: One will either build his/her project around phpBB or build phpBB around that project. In other words one would use phpBB as a tool (like for example symfony component) or use some other tool/s to build around phpBB or for phpBB (extensions for example).

Don't get me wrong.. I'm not saying that what you want is bad or wrong, but as i see it, merging (or building a bridge) cms or WP type project with full package phpBB is not a good idea.
Usus est magister optimus! phpBB pre-Triton & latest php environment.
When answer lies in the question, question becomes redundant!
User avatar
axe70
Registered User
Posts: 752
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by axe70 »

Don't worry, I know you now. Let's say you set up your own topics and make it your own blog
No well, i also release some line of code that work even if it is strange! :D The free integration phpBB WP 2.5.6 work like a charm now!
It was containing just a wrong option hint into plugin admin, just committed and fixed, i challenge anyone to find a bug on it now :D
And this extension will be nice to do, linking on it any cms: to get data in true, it is just needed to change queries against different cms schemas. It will be cool i think (the one i did for the phpBB WP integration, with possibility to link instead anything else, not only WP)

GanstaZ wrote: Thu Feb 17, 2022 2:55 pm I don't know about 0 cost as to me it seems that it will cost more than 0. One thing i can say, it is totally based on my view: One will either build his/her project around phpBB or build phpBB around that project. In other words one would use phpBB as a tool (like for example symfony component) or use some other tool/s to build around phpBB or for phpBB (extensions for example).

Don't get me wrong.. I'm not saying that what you want is bad or wrong, but as i see it, merging (or building a bridge) cms or WP type project with full package phpBB is not a good idea.
Hello! 0 cost mean to me ever this: the task you go to add, have to not overload phpBB or the cms where you go to apply.
It is not my pleasure, even if it could be, it is a precise client requirement. And i have to accomplish, like it or not!
They wants also digests: so i also modified related extension to have full names into digests. And not only, also into any email notification.
All grabbed by wp db on the fly, with a fast query. But i want it improved now someway
Do not take me too serious
Anyway i do not like Discourse
User avatar
halil16
Registered User
Posts: 1281
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by halil16 »

It's easy to do. At least I use it on profile pages and topic pages when hovering over the user name.

Create a custom profile field.
Ex: Full Name

Note: Let it be a single line of text. Let the field id be full_name.

Then use this code:

Code: Select all

{PROFILE_FULL_NAME_VALUE}
I did not use it in the listings on the forum pages, as I wanted the general username to appear. I don't know if it works there. But it will work on topics and profile pages.
* Hire me at fiverr for your phpBB board.
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa
I'm learning English...
Contributions: #Hashtag, Elegance, Latte
User avatar
halil16
Registered User
Posts: 1281
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil
Contact:

Re: Change username with first name and surname extracted elsewhere

Post by halil16 »

I missed something. For it to work on topics, it should be used like this: {postrow.PROFILE_FULL_NAME_VALUE}
* Hire me at fiverr for your phpBB board.
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa
I'm learning English...
Contributions: #Hashtag, Elegance, Latte
Post Reply

Return to “Extension Writers Discussion”