The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Delete WordPress Users created with Registration Add-On

Labels

This Discussion is public

Notifications

Greetings,

Recently I've been looking for a solution where I could delete WordPress Users (created with the Registration Add-On) by simply deleting their profile entry.  After piecing together some custom code and receiving a few tips from Jamie, I finally have something that does the job!  Since I'm not a developer, I've been enjoying and using several pieces of code provided by other users on the help desk.  I'm sharing this little piece of code in hopes that it will help someone else in the same way.
add_action('frm_before_destroy_entry', 'my_custom_function');
function my_custom_function($entry_id) {
$entry = FrmEntry::getOne($entry_id);
if ( $entry->form_id == 27 ) { // change 27 to your form id
$username = FrmProEntriesController::get_field_value_shortcode(array('field_id' => 459, 'entry' => $entry_id));//change 459 to the field id of your username field
$user = get_user_by( 'login', $username );
wp_delete_user( $user->ID );
}
}

Thanks again.

Awesome mate thanks a ton

Just wanted to confirm this still works fine with recent wordpress and formidable updates?

I'm not clear on what you mean when you say "where I could delete WordPress Users (created with the Registration Add-On) by simply deleting their profile entry." Do you mean from the frontend  when you are logged in as administrator?

And an even more naive question, where does this code go? In the User Registration form?

Discussion closed.