Home › Forums › WordPress Plugins › Apply digest settings to all users
- This topic has 2 replies, 2 voices, and was last updated 6 years, 7 months ago by
Pam Barry-Santos.
-
AuthorPosts
-
-
May 3, 2017 at 10:36 am #5550
Pam Barry-Santos
ParticipantWe’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 -
May 3, 2017 at 10:44 am #5551
vinny
KeymasterHi Pam,
It’s simple. When you import, just make sure that whatever importer solution you’re using adds key
BbpnnsDigest_frequency
and valuedaily
to theusermeta
table.You can also insert it with SQL if you’re comfortable with it.
Cheers,
Vinny -
May 9, 2017 at 1:00 am #5592
Pam Barry-Santos
ParticipantThanks. 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'); }
-
-
AuthorPosts
- You must be logged in to reply to this topic.