Affichage des articles dont le libellé est Registered. Afficher tous les articles
Affichage des articles dont le libellé est Registered. Afficher tous les articles

samedi 12 novembre 2016

How to Show Total Number of Registered Users in WordPress



Have you ever wanted to show the total number of registered users on your WordPress site? Social proof like showing the number of registered users on your site, encourages others to register as well. In this article, we will show you how to show total number of registered users in WordPress.


How to Show Total Number of Registered Users in WordPress


Method 1: Show Registered User Count Using a WordPress Plugin


First thing you need to do is install and activate the Simple Blog Stats plugin. For more details, see our step by step guide on how to install a WordPress plugin.


Upon activation, you need to visit Settings » Simple Blog Stats page to configure plugin settings.


Settings page for Simple Blog Stats


This plugin allows you to show different stats from your WordPress site. You need to click on the shortcodes tab to expand it and then scroll down to the ‘number of users’ row.


Users shortcode settings


You will see the shortcode [sbs_users] with two text fields on both sides. These text fields contain HTML the plugin will add before and after the number of users.


By default, the shortcode will output HTML like this:



<span class="sbs-count-users">856</span>

If you are unsure, then just copy the shortcode [sbs_users] and click on the save settings button.


You can now add this shortcode to any WordPress post or page. You can also add it to a sidebar widget. If the shortcode does not work in the widget, then follow instructions in our guide on how to use shortcodes in your WordPress sidebar widget.


Method 2: Manually Show Number of Registered Users in WordPress with Code


This method requires you to add code to your WordPress site. If you haven’t done this before, then see our beginner’s guide on pasting snippets from web into WordPress.


You need to add the following code to your theme’s functions.php file or a site-specific plugin.



// Function to return user count
function wpb_user_count() {
$usercount = count_users();
$result = $usercount['total_users'];
return $result;
}
// Creating a shortcode to display user count
add_shortcode('user_count', 'wpb_user_count');

This code creates shortcode [user_count] which you can use in your WordPress posts, pages, or a sidebar widget to display the user count.


The function does not add any HTML formatting to the user count and simply returns the number. You may want to wrap the shortcode around HTML to use CSS or basic HTML formatting. For example:



<p>Join <strong>[user_count]</strong> other users who share your interest:</p>

Here is how it looked on our demo site:


Showing total number of users in WordPress widget


Note: We added a free signup button that redirected to a custom WordPress user registration page.


That’s all, we hope this article helped you learn how to show the total number of registered users in WordPress. You may also want to see our guide on how to moderate new user registrations in WordPress.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Show Total Number of Registered Users in WordPress appeared first on WPBeginner.







How to Send Email to All Registered Users in WordPress



Have you ever wanted to send a mass email to all registered users on your WordPress site? f you run a multi-user WordPress site, then sometimes you may need to send notifications emails to your users. In this article, we will show you how to send email to all registered users in WordPress.


Email all registered users in WordPress


Why and When You Need to Send Email to All Registered Users in WordPress?


If you allow user registration on your WordPress site, then you may be automatically adding registered users to your email list as well.


In case you are not adding your registered users in an email list, or your email list is not segmented, then you would need an alternative solution to send a mass email to all registered users.


You can use this feature to send emails about important announcements, account status, password update requests, and more.


Let’s see how you can easily email all registered users on your WordPress site.


Sending Email to All Registered Users in WordPress


First thing you need to do is install and activate the Email Users plugin. For more details, see our step by step guide on how to install a WordPress plugin.


Upon activation, the plugin will add a new menu item labeled ‘Email User’. Clicking on it will take you to the page where you can choose who you want to email.


Email users


You can send individual message to specific users, or you can send a message to user groups. Users with the same user role have the same user group for example, administrators, editors, authors, subscribers, etc.


You need to click on ‘Send Individual Message’ link to send email to specific or all users on your WordPress site.


Sending emails to individual or all users on your site


Start by selecting a mail format for your email and then select recipients from the drop down list. You can use the CTRL (Command key on Mac) to select multiple users.


Next, you need to add a subject line and your email message. Once you are satisfied with the email message, click on the Send Email button.


The plugin will send your email message to all selected users.


Sending Email to User Groups in WordPress


User Email plugin also comes with a feature that allows you to send emails to specific user roles.


This feature is helpful if you have a lot of users, and you can’t select them all one by one in the individual message form. It is also helpful when you just want to email specific user roles like authors or editors.


You will need to visit Email Users » Send to Group(s) page.


Send email to specific user roles or groups


First you need to select a mail format (Plain text or HTML) for your email message. After that you can select which user roles or groups you want to send this email to.


Next, add a subject for your email message and then add the email message that you want to send. Click on the Send Email button to send the message.


Turning Emails On/Off for Specific Users in WordPress


You can select which users will receive individual or group messages by visiting the Email Users » User Settings page.


Manage email settings for users


Select the user you want to edit and then select an action from bulk actions menu. You can turn off notifications (individual messages) as well as mass emails (emails sent to multiple users or user groups).


When you have made your changes, make sure to click on the apply button to save your changes.


Individual users on your site can control email settings on their profile pages as well.


Upon login, users can go to their Profile page, and they will notice two new options to opt-in or out of email messages.


Email preferences


Troubleshooting Email Issues


If you are having problems sending email from your WordPress website, then see our guide on how to fix WordPress not sending email issue.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Send Email to All Registered Users in WordPress appeared first on WPBeginner.