Useful Functions for Sites with Subscribers

If you have you have a lot of user accounts for subscribers (or customers if using WooCommerce or Easy Digital Downloads), you might find these functions useful for blocking access to the dashboard and simplifying logins.

Allow Users to Use Their E-mail Address to Login

Your visitors probably already have a lot of usernames to remember. Why make it harder on them? Allow them to user their e-mail address as a username.

https://gist.github.com/devinsays/1b03494b5eae702d6e35

Disable Admin Bar for Specific Users

Most websites look a lot nicer without that black bar across the top. Hide it for users that can’t edit posts.

https://gist.github.com/devinsays/c45d35e2a7020d47833e

Redirect Users Who Attempt to Access Dashboard

If your users don’t need to access the dashboard, make sure they can’t access it. This code redirects any visitor that doesn’t have permissions to edit posts back to the home page if they attempt to access anything wp-admin.

https://gist.github.com/devinsays/e7a4d3d889069e5c40f7

About Devin

I am a developer based in Austin, Texas. I run a little theme shop called DevPress and help manage a WooCommerce shop with Universal Yums. Find me on twitter @devinsays.

2 Responses

Leave a Reply to Anh Tran Cancel reply