Shop Forums WordPress Plugins Apply digest settings to all users Reply To: Apply digest settings to all users

#5592

Pam Barry-Santos
Participant

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');
}