One of the reasons WordPress is awesome is that it comes with its own fully functioning user authentication system. Writing that from scratch these days would be pretty dumb if you don't plan to bring a heaping pile of innovation to the process.

Restrict Content Pro, our membership plugin, of course doesn't re-invent the wheel. It just extends what the WordPress user system does by appending subscriptions to users.

So when we set out to add a login form for our users, we're essentially just exposing the WordPress login in our template rather than redirecting them to /wp-login.php - which is the default. The function wp_login_form() is what we need.

We use a bit of logic about when to show it. If a user is logged out, they get a login form. If they are logged in, they get a "Welcome Back!" module instead.

Leave a Comment

Posting Code

We highly encourage you to post problematic HTML/CSS/JavaScript over on CodePen and include the link in your post. It's much easier to see, understand, and help with when you do that.

Markdown is supported, so you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences like this:

```
<script>
  function example() {
    element.innerHTML = "<div>code</div>";
  }
</script>
```

We have a pretty good* newsletter.