Yes, we need jQuery for that. The first thing is to give proper classes and ID’s to the elements.
In manage_users_custom_column
, add a class and a data selector to the checkbox:
"<input type="checkbox" data-approval="#approval-$user_id" class="my-class" value="{$column_value}" />"
And in user_row_actions
, an ID to the <a>
tag: id='approval-$user_id'
.
Now, we have all the elements properties and can manipulate the URL of the Approve with changes links.
add_action( 'admin_footer-users.php', 'print_jquery_wpse_117481' );
function print_jquery_wpse_117481()
{
?>
<script type="text/javascript">
jQuery(document).ready(function($)
{
$('.my-class').click(function(e)
{
console.log( 'Is checked: ' + $(this).is(':checked') );
console.log( 'This ID: ' + $(this).attr('id') );
var a_href_approval_id = $(this).data('approval');
var a_href_final = $( a_href_approval_id ).attr('href');
console.log( 'Manipulate this attribute: ' + a_href_final );
});
});
</script>
<?php
}
Hint: use sprintf
to build $checkbox
.