jeudi 5 février 2015

Delete Users using a Front End Form


I viewed this question and would like to see how it was solved. I've been looking all over for help with this. I'm not sure if this link needs to be used within a <form> element.


This is the function I have



if( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'ppt_delete_user' ) {
add_action( 'init', 'ppt_delete_user_cb' );
}
function ppt_delete_user_cb( $user_id ) {
$url = add_query_arg( array(
'action' => 'ppt_delete_user',
'user_id' => $user_id
));

echo "<a href='" . $url . "'>Delete User</a>";
}


And here is the form that I have



echo '<form action="ppt_delete_user" method="post">';
$users = get_users();

foreach( $users as $user ) {
$user_id = $user->ID;
echo '<div class="existing-users">' . $user->user_email . ' | ' . ppt_delete_user_cb( $user_id ) . '</div>';
}
echo '</form>';


When I click on the Delete User link, the URL shows the Query Vars but nothing happens. Any ideas on how to correct this?





Aucun commentaire:

Enregistrer un commentaire