ui-avatars icon indicating copy to clipboard operation
ui-avatars copied to clipboard

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

Open 3D-I opened this issue 6 years ago • 4 comments

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']);

3D-I avatar Oct 13 '17 21:10 3D-I

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 😄

LasseRafn avatar Oct 15 '17 01:10 LasseRafn

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

3D-I avatar Oct 15 '17 03:10 3D-I

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 avatar Oct 21 '17 19:10 3D-I

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

3D-I avatar Nov 03 '17 02:11 3D-I