Making WordPress.org


Ignore:
Timestamp:
05/14/2016 12:27:03 PM (9 years ago)
Author:
ocean90
Message:

Trac: Use user's nicename for gravatars and profile links.

Adds wporg_sanitize_user_nicename() which simulates bb_sanitize_with_dashes() from bbPress.

See #1462.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/trac.wordpress.org/templates/site.html

    r3139 r3140  
    3131    except (IndexError, KeyError):
    3232        pass
     33
     34    import re
     35    def wporg_sanitize_user_nicename(str):
     36        str = str.lower()
     37        str = re.sub(r'[^%a-z0-9\x80-\xff _-]', '', str)
     38        str = str.strip()
     39        str = re.sub(r'\s+', '-', str)
     40        str = re.sub(r'-+', '-', str)
     41        str = re.sub(r'_+', '_', str)
     42        return str;
     43
    3344?>
    3445
Note: See TracChangeset for help on using the changeset viewer.