- This topic has 2 replies, 2 voices, and was last updated 7 years, 6 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Home › Forums › WordPress Plugins › Apply digest settings to all users
We’re importing users from another site and want to set them all to get a daily digest email. I know we can change this for new users (to set the default), but is there a way to set this for all users? We have over 900 and don’t want to have to do this manually. They were all set to daily in our previous site, so this wouldn’t be a change for them.
Thanks.
Pam
Hi Pam,
It’s simple. When you import, just make sure that whatever importer solution you’re using adds key BbpnnsDigest_frequency
and value daily
to the usermeta
table.
You can also insert it with SQL if you’re comfortable with it.
Cheers,
Vinny
Thanks. I ended up adding it through php in order to get it to apply to all users (we had already imported 800 users). And because the digest option wasn’t on for the users, I also had to enable the digest (before it showed it being “on” in the profile page in WordPress admin pages).
I had to hunt around a bit to find the right combo (I’m not a coder), so thought I’d share what worked for me in case someone else needs the info.
I added the code below to functions.php, refreshed the site (to run the code) and then removed the code (only needs to run the one time to update/add the changes).
$users = get_users( ['fields' => ['ID'] ] );
foreach ( $users as $user ) {
$user_update = update_user_meta($user->ID, 'BbpnnsDigest_frequency', 'daily');
}
$users = get_users( ['fields' => ['ID'] ] );
foreach ( $users as $user ) {
$user_update = update_user_meta($user->ID, 'BbpnnsDigest_enabled', '1');
}
© UseStrict Consulting - All rights reserved