[wp-hackers] URL of edit profile page

Andrew Nacin wp at andrewnacin.com
Mon Feb 28 22:55:26 UTC 2011


On Mon, Feb 28, 2011 at 5:48 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:

> function get_user_profile_link($userid) {
>        global $wp_version;
>
>        if (version_compare($wp_version, "3.1", "<")) {
>                // If the version is before 3.1 use this method
>                return admin_url('profile.php');
>        }else{
>                // 3.1 or  later
>                return get_edit_profile_url($userid);
>         }
> }
>


Please prefix your functions. [1]

Also, instead of doing a version compare, simply do a function_exists() on
get_edit_profile_url(), and use it if it does. Better to check for features
than versions.

[1] http://andrewnacin.com/2010/05/11/in-wordpress-prefix-everything/

Nacin


More information about the wp-hackers mailing list