Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it an array the "multiple usernames joined" exclusions on a per use case #6

Open
3D-I opened this issue Oct 13, 2017 · 4 comments

Comments

@3D-I
Copy link

3D-I commented Oct 13, 2017

It happens some fancy user likes to join multiple usernames with an hyphenation or the likes, I started making an array of exclusions which is managed as per admin's choice in the phpBB's ACP (Administration Control Panel)

This way.. you know ;)

/* for user "John Doe" or "John_Doe" use 'John+Doe' etc */ $pia_rep_ary = [' ', '_']; $name = str_replace($pia_rep_ary, '+', $this->user->data['username']);

@LasseRafn
Copy link
Owner

Wouldnt this work by replacing the variables locally instead? Like:

// User Model/Class
...
function formattedUsername() {
  $username = $this->data['username'];

  $username = str_replace('_', '+', $username);
  $username = str_replace(' ', '+', $username);

  return $username;
}

// Usage
<img src="<?php echo 'https://ui-avatars.com/api/?name=' . $this->user->formattedUsername(); ?>" />

I just feel that this may be a little out of scope for the core library, to handle, but I'm not sure 😄

@3D-I
Copy link
Author

3D-I commented Oct 15, 2017

Yup, that's fine. :) I will re-think about the purpose though.

@3D-I
Copy link
Author

3D-I commented Oct 21, 2017

Well, easily managed on the present code so no probs.
Just thinking about an username like: AlexanderTheGreat ..
how would it be the more elegant way to deal with it and have a result like this: ATG ?¿
Is it something the API should take into consideration IYO?

@3D-I
Copy link
Author

3D-I commented Nov 3, 2017

Hi, any news on this? Are you still working on the API mate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants