wordpress snippets last updated   : October 6, 2014
we now have 641 snippets
category user

Add and remove wordpress user roles

wordpress snippet

With WordPress you can add and remove roles very easily. The first snippet will add a new role called “manager” with some basic capabilities. You can view the WordPress roles and capabilities page for more extensive details on the capabilities available that you can assign to a custom role. The second snippet will remove some of the existing roles “editor, author, contributor, subscriber” however this could also remove a custom role. NOTE: if you remove an existing role it will be gone! So please be careful when removing roles.

read more

Change default role names “Administrator, Editor, Author, Contributor, Subscriber” to anything

wordpress snippet

Have you ever wanted to change the default role names “Administrator, Editor, Author, Contributor, Subscriber” within wordpress? Add this little snippet to the functions.php of your wordpress theme. This snippet will let you change any of the existing role names to anything that you would like. This will of course display within the role select menu for users.

“Please note this does not add a new role or permanently change the name”

read more

List All Available wordpress Roles

wordpress snippet

Here is a snippet showing how to list all available roles. I recently used this snippet to add a role selector in the registration page. You could also use it for user searches, or post filters.

read more

Redirect based on user roles or capabilities

wordpress snippet

Redirecting based on a user role or capabilities could be a valuable addition depending on the needs of your WordPress site. This would allow you to redirect specific capabilities to a custom page with details about new content or features. You could also use this to redirect users with higher user roles directly to the WordPress wp-admin. For more details on the capabilities available in wordpress visit the wordpress codex. To use this snippet just add it to the functions.php of your wordpress theme and you will be redirect users based on roles or capabilities like a pro.

read more

Remove admin color scheme options from user profile

wordpress snippet

This is an alternative method to the one I posted some time ago, “Remove admin color scheme picker from profile” Adding this snippet to the functions.php of your wordpress theme will remove the admin color scheme from the user profile.

read more

Send email notification when profile updates

wordpress snippet

I got a few emails asking about sending an email when a user simply updates the profile. Well here it is, adding this snippet to the functions.php of your wordpress theme will send an email notification to the user when the user profile updates.

read more
jqsnipp.com | we just launched jquery snippets website