title: Display simple public user profile for all registered users (not just authors)
body: <p>In <a href="https://github.com/afarber/wp-newbie/blob/master/wp-city-gender/wp-city-gender.php" rel="nofollow">a simple WordPress plugin</a> I have redirected commenter links to the URL <code>/user/user_id</code> with the following code:</p>
  
  <pre><code>define('PROFILE', '&lt;a href="/user/%d"&gt;%s&lt;/a&gt;');
  
  function my_get_comment_author_link($comment_ID) {
      global $comment;
      return sprintf(PROFILE, $comment-&gt;user_id, 
                              $comment-&gt;comment_author);
  }
  
  add_action('get_comment_author_link',
             'my_get_comment_author_link');
  </code></pre>
  
  <p>How could I please show a simple public user profile (for all registered users and not just authors) displaying the user name at that URL?</p>
  
  <p>I guess I should create a PHP script in my child 2013 theme -</p>
  
  <pre><code>&lt;?php
  /* Template Name: Public User Profile */
  ?&gt;
  
  &lt;?php get_header(); ?&gt;
  
  &lt;?php 
        $my_query = new WP_Query($args);
        // somehow get the user ID out of URL?
        // somehow get the WP_User object?
        printf('&lt;p&gt;Name: %s&lt;/p&gt;', $user-&gt;display_name);
  ?&gt;
  
  &lt;?php get_footer(); ?&gt;
  </code></pre>
  
  <p>But how to make the WordPress to execute that PHP script, when the URL <code>/user/user_id</code> is reuqested?</p>
  
  <p>Should I use the <a href="http://codex.wordpress.org/Rewrite_API" rel="nofollow">Rewrite API</a> here and how? I have tried the following, but don't see any effect:</p>
  
  <pre><code>                    add_rewrite_rule('/user/(\d+)',
                                       'index.php?XXX=$matches[1]',
                                       'top'
                      );
                      flush_rewrite_rules();
  </code></pre>
  
  <p>Or am I missing something, like maybe I should add a custom post type first? (As you see - I am confused and "lost in the docs").</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Can I maybe override <code>the_content</code> hook - but how to detect that a <code>/user/user_id</code> page has been called?</p>
  
  <pre><code>function my_content($content)
  {
      if (NOT /user/user_id CALLED)
          return $content;
  
      // otherwise somehow extract the user_id
      // somehow get the corresponding WP_User
      return sprintf('&lt;p&gt;Name: %s&lt;/p&gt;', $user-&gt;display_name);
  }
  
  add_action('the_content', 'my_content');
  </code></pre>