If username differs from display name, have link title change to username

Started by samborabora, July 29, 2014, 05:26:20 AM

Previous topic - Next topic

samborabora

Okay, as I said, I'm a sh1t coder, so this is what I've mocked up myself, please don't laugh:

$memberContext[$user] = array(
'username' => $profile['member_name'],
'name' => $profile['real_name'],
'id' => $profile['id_member'],
'is_buddy' => $profile['buddy'],
'is_reverse_buddy' => in_array($user_info['id'], $buddy_list),
'buddies' => $buddy_list,
'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '',
'href' =>$scripturl . '?action=profile;u=' . $profile['id_member'],
'link' =>

if $profile['member_name'] != $profile['real_name'])
echo '
'<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="aka ' . $profile['member_name'] . '">' . $profile['real_name'] . '</a>',;

elseif $profile['member_name'] = $profile['real_name'])
echo '
'<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="">' . $profile['real_name'] . '</a>',;


I have no idea how to incorporate logical operators into arrays, but I also had no luck in taking:
a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="">' . $profile['real_name'] . '</a>

Changing it into:
a href="' . $scripturl . '?action=profile;u=' . $message['id_member'] . '" title="">' . $message['real_name'] . '</a>
And throwing that into display.template.php, in replacement of:
$message['member']['link']

So, hopefully this will give some insight into what I am attempting. I am sorry if my reputation has been damaged for whatever reason throughout the last 36 hours events, I apologize for appearing antagonistic, but I really just wanted to confirm that we we're all talking about the same thing. Next time, I'll try harder to word my requests more easily (should there be a next time!)

Kindred

which is basically what Arantor suggested.. but the OP has insisted that we are all wrong and that he feels it is absolutely necessary to display the user's actual login username, despite all evidence that this is a poor idea
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

No, we're not all talking about the same thing. What you originally described as your use case (which is what Bigguy quoted) is not the solution you have presented.

You are assuming that users only make a reputation under their original name and that their current name is only temporary, which it isn't.

If you ever want to deal with the situation of users changing their names and users having culture shock with that, you absolutely have to consider the entire display name history as previously pointed out complete with examples.

Because I have never ever seen this or had to deal with this before, not even on this forum, because people never get confused when I change my display name on occasion.

Under your logic, the name I am best known for would never, ever be displayed. Despite having thousands upon thousands upon thousands of posts made under that name.

Under my logic, all the names I have used would be known, but my way carries a performance cost that cannot be easily rectified even if it were recognised as a valid solution, but since you're already convinced that your solution solves your problem (even though it doesn't), I should have heeded my earlier instinct.

samborabora

Thanks for everyones time today, this works:
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '"' . ($profile['member_name'] == $profile['real_name'] ? '' : ' title="aka ' . $profile['member_name'] . '"') . '>' . $profile['real_name'] . '</a>',

A painfully simple solution for an incredibly controversial subject, appreciate everyone's excitement towards this thread, positive or negative!

Arantor

Don't be surprised if users still get confused when display names change.

Kindred

I wouldn't exactly call it controversial either... given the fact that EVERYONE *EXCEPT* YOU was saying the same thing....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Burke ♞ Knight

1. Make sure your members know about this.
2. Do not be too surprised if they also say what we all said.
3. Do not be too surprised if you see members leave your site over this.
4. Make sure you did backups before doing all that. ;)

Bigguy

With a bit of tweaking though this could be a mod. Like say if you mouseover someone's name in a post, instead of it saying "View the profile of whoever" it could tell you what the person's last display name was. Not their real name or anything but what they changed their dis.....oh you guys get the idea. I think it would help on sites where everyone loves to call themselves different things each month, ya know, like here, lol. :)

Arantor

Quoteit could tell you what the person's last display name was.

I'd love to know you plan on doing that since that's not actually stored anywhere.

Only the original username and the current display name are stored, which is kind of the point I've been trying to make all this time that interim names aren't stored anywhere meaning you can't display them, meaning that people who change their names regularly are just as confusing to people because no useful information or context is preserved.

Bigguy

Well, I would think (Not being a coder myself) that you would have to cache the last display name or something and then be able to call it back just when ever the user changes his display name. You would only store the last change though not a history of it. (Just a off the top of my head thing) :)

Arantor

That's doable - it's just not something doable right now because there's literally nowhere to do it, so you'd have to create a place to store it and then store it and then retrieve it.

And if you're doing *that*... it's not significantly more effort to store past names, but any changes like this have consequences.

but this all still requires accepting the very notion that you need more than just the first and the last names a user has had.

Bigguy

Well, I don't know. I thought it might be cool. Maybe one day someone will take on a small project like this. If I new how to code I think I might do it but that'll have to wait till I learn a lot more. :)

Hj Ahmad Rasyid Hj Ismail

Reading all the arguments, I think may be the OP want to have a look at this mod: http://custom.simplemachines.org/mods/index.php?mod=1841

This mod creates post history that is traceable. In other words as mentioned in its mod page, it allows to store old versions of posts and viewing edit history of post with permission can be set either to own or all posts. If the OP need the old display name(s), he may similarly need to store them before calling them back whenever he needs them.

In terms of security of displaying username, as stated by Illori, I suppose that is something default unless the forums' admins themselves require user(s) to have display name that is different from username upon registration. To promote this behavior is to change how SMF forums deal with default user(s) registration.

Arantor

How does post history deal with users who change their display name???

Hj Ahmad Rasyid Hj Ismail

They don't. OP might want to take a look how that mod adds post history which is not available by default to create his own mod to adds display name history which is also not available by default.

Arantor

Except it's completely the wrong way to solve the problem. There you're dealing with a history of a suitably large block of data that a new table is probably the best solution. But for display names, it's really not.

Hj Ahmad Rasyid Hj Ismail

I don't know how it should be done either. For me a sample won't hurt unless it is blindly followed. ;)

samborabora

Thanks for the suggestions, I would expect that a username history would require a new sql table and a store/retrieve function, which is why it did not appeal to me, although in the case of Bigguy requirements, this would be a certain solution. I'm not sure why Arantor started suggestion the username history as it was such an complex solution to my incredibly humble requirements, which, although I am not a good enough coder to have worked out entirely by myself, seemed just as simple as it was eventually proposed as a modification.

'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '"' . ($profile['member_name'] == $profile['real_name'] ? '' : ' title="aka ' . $profile['member_name'] . '"') . '>' . $profile['real_name'] . '</a>',

This string in the member array does absolutely everything I wanted, and this would have been all I needed to have been given on post #2. It would have made my day and if anyone hated this mod they didn't necessarily have to use it, but it was fun arguing about it I guess.

Quote from: Kindred on July 30, 2014, 07:03:16 PM
I wouldn't exactly call it controversial either... given the fact that EVERYONE *EXCEPT* YOU was saying the same thing....

Quote
controversy  (ˈkɒntrəˌvɜːsɪ, kənˈtrɒvəsɪ)

— n  , pl -sies
dispute, argument, or debate, esp one concerning a matter about which there is strong disagreement and esp one carried on in public or in the press

... not necessarily an equally divided opinion...

Quote from: ‽ on July 30, 2014, 04:58:05 PM
Also, it's not one line to be changed. It's actually several in several places.

...and I never will know what you meant by that when:

'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '"' . ($profile['member_name'] == $profile['real_name'] ? '' : ' title="aka ' . $profile['member_name'] . '"') . '>' . $profile['real_name'] . '</a>',

But thanks all, problem solved, you can all go back to your homes :D

Arantor

Because I'm still convinced you have misunderstood what you think the problem is. I've seen this so many times where people are so convinced they have a solution, but all they've done is exchanged one problem for another.

Also, I can think of at least two solutions that don't require a new table.

samborabora

Quote from: ‽ on July 31, 2014, 07:20:33 AM
Also, I can think of at least two solutions that don't require a new table.

Care to venture a suggestion? You're saying now that username history IS stored? I don't need a new table, but a username history mod would.

QuoteBecause I'm still convinced you have misunderstood what you think the problem is. I've seen this so many times where people are so convinced they have a solution, but all they've done is exchanged one problem for another.

Problems? I have no problems now, topics marked solved.

Advertisement: