PDA

View Full Version : different alphabet index for members list


dimitrisvb
11-25-2008, 11:06 AM
hi all!
is there a way to have the a different alphabet index (greek) for the members list?

thanks, :)
Dimitris

ReCom
11-25-2008, 11:24 AM
Open memberlist.php and modify the following portion to display your character set:
// now do alpha-characters
for ($i=65; $i < 91; $i++)
{
$currentletter = chr($i);
$linkletter =& $currentletter;
$show['selectedletter'] = $selectedletter == $currentletter ? true : false;
eval('$letterbits .= "' . fetch_template('memberlist_letter') . '";');
}
Hint: you would need to define the character set in an array, then do a foreach on the array to assign each character to $currentletter.

dimitrisvb
11-25-2008, 12:16 PM
thanks for the help! :D it works! :up:

I just changed the character indeces to the greek ones.

It seems, there's a non-character in position 210 though, breaking the alphabet in two! It must be an empty place, left there before the capital sigma because there are two lower case sigmas and thus, the rest of the capitals will correspond correctly with the lower case ones.

To resolve this, I have used two different loops:

// now do alpha-characters
for ($i=193; $i < 210; $i++)
{
$currentletter = chr($i);
$linkletter =& $currentletter;
$show['selectedletter'] = $selectedletter == $currentletter ? true : false;
eval('$letterbits .= "' . fetch_template('memberlist_letter') . '";');
}

for ($i=211; $i < 218; $i++)
{
$currentletter = chr($i);
$linkletter =& $currentletter;
$show['selectedletter'] = $selectedletter == $currentletter ? true : false;
eval('$letterbits .= "' . fetch_template('memberlist_letter') . '";');
}


This produces a greek alphabet index! Now, when I click on the letters, ordening doesn't seem to work properly but I suppose, this has to do with the fact we're only 16 members yet. :o

Thanks a lot for the tip, ReCom! You have helped big deal! :D

Now, if you only had some advice as to how I could arrange it so that only greek letters are accepted for usernames! :rolleyes:

ReCom
11-25-2008, 12:35 PM
Now, if you only had some advice as to how I could arrange it so that only greek letters are accepted for usernames! :rolleyes:
You would need to use regular expression (regex) for that:

1. Go to AdminCP > vBulletin Options > User Registration Options.

2. Look for setting "Username Regular Expression".

3. Now let say you want to limit the usernames to those containing a, b, c, d or e only. You would need to write in the setting:
^[abcde]$

4. So to allow greek characters only you need to replace 'abcde' with a string of all greek characters. Quite a long string I'd imagine :rolleyes:

Perhaps there's a better way, probably using plugin. Will look into it further. :)

EDIT:
you can add plugin that hooks to register_addmember_process:

1. Check if $vbulletin->GPC['username'] is valid (greek characters only) using any PHP algorithm you want.
2. If it's invalid, append array $userdata->errors with your error message.

dimitrisvb
11-25-2008, 04:37 PM
You would need to use regular expression (regex) for that:

1. Go to AdminCP > vBulletin Options > User Registration Options.

2. Look for setting "Username Regular Expression".

3. Now let say you want to limit the usernames to those containing a, b, c, d or e only. You would need to write in the setting:
^[abcde]$

4. So to allow greek characters only you need to replace 'abcde' with a string of all greek characters. Quite a long string I'd imagine :rolleyes:

I have tried it but it doesn't seem to work!
I have entered all greek characters (upper and lower case, with accents) within this notation: ^[ ]$
in the "Username Regular Expression" field. Then I tried to create a user but neither greek nor latin characters would be accepted by the system! When I emptied the field, registration would work again!

EDIT:
you can add plugin that hooks to register_addmember_process:

1. Check if $vbulletin->GPC['username'] is valid (greek characters only) using any PHP algorithm you want.
2. If it's invalid, append array $userdata->errors with your error message.


I'll see if can make anything out of these notes! :o
thanks!

ReCom
11-25-2008, 09:59 PM
I have tried it but it doesn't seem to work!
I have entered all greek characters (upper and lower case, with accents) within this notation: ^[ ]$
in the "Username Regular Expression" field. Then I tried to create a user but neither greek nor latin characters would be accepted by the system! When I emptied the field, registration would work again!
Sorry it should have been ^[ ]+$ .. my mistake :p

dimitrisvb
11-27-2008, 08:50 AM
Sorry it should have been ^[ ]+$ .. my mistake :p

indeed! this works!!!!!
thanx ReCom! I owe you! :D

ANGEL OF FIRE
02-21-2010, 11:40 AM
How to make it under Vb4? Its code strongly differs.

Whether somebody can help?