Skip to content

Instantly share code, notes, and snippets.

@DumahX
Created March 16, 2022 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DumahX/e04a5f71667c25f47fb226e5ef33abfc to your computer and use it in GitHub Desktop.
Save DumahX/e04a5f71667c25f47fb226e5ef33abfc to your computer and use it in GitHub Desktop.
<?php
function add_optin_status($user) {
if(isset($_POST['meprconvertkit_opt_in'])) {
update_user_meta($user->ID, 'mepr_convertkit_optin_status', true);
} else {
update_user_meta($user->ID, 'mepr_convertkit_optin_status', false);
}
}
add_action('mepr-signup-user-loaded', 'add_optin_status', 11);
function render_optin_status_field($user) {
?>
<tr>
<th>
<label>Opt-In Status</label>
</th>
<td>
<?php if(get_user_meta($user->ID, 'mepr_convertkit_optin_status', true)): ?>
User has opted in to newsletter.
<?php else: ?>
User has NOT opted in to newsletter.
<?php endif; ?>
</td>
</tr>
<?php
}
add_action('mepr_extra_profile_fields', 'render_optin_status_field');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment