I am quite new in wordpress dev and I am writing an Admin plugin to handle certificate creation. I achieve to create the plugin, and I have it in the Admin Menu via the add_menu_page.
Here is the plugin concept:
- I used the WP_List_Table to display the list of users.
- I have added custom columns with some user meta-data.
- I have added a custom column with a button. This button should display a form (with the correct items data to create a certificate. this form is designed in the file test.php. (Exactly the same way the edit user link is acting).
What I would like to do is : I would like my button to open another php page that contains a Form and process that forms. And After go back to the previous page. More or less the same way the Users Admin do with the Users-edit.php page.
My plugin name is gbr-certificate.
My issues :
I don't know how to link to my php page that contains the form (test.php). This files is in my plugin root directory. I have tried :
- hard coding the url : In the column_default function adding the following code for the button :
$link = "http://localhost:8888/Standard/wp_content/plugins/gbr-certificate/test.php?user-id=" . $item->ID . "&wp_http_referer=" . urlencode( wp_unslash( $_SERVER['REQUEST_URI']));
$btn = "<button id=\"cert-\" class=\"button\" href=\"" . $link . "\">create cert.</button>";
Result => I have the right links in my button href :
<button id="cert-" class="button" href="http://localhost:8888/Standard/wp_content/plugins/gbr-certificate/test.php?user-id=1&wp_http_referer=%2FStandard%2Fwp-admin%2Fadmin.php%3Fpage%3Duser-cert-manager">create cert.</button>
But when i Click it => i get to the following url :
http://localhost:8888/Standard/wp-admin/admin.php?s=&_wpnonce=feb9b81efe&_wp_http_referer=%2FStandard%2Fwp-admin%2Fadmin.php%3Fpage%3Duser-cert-manager&paged=1
with a blank page displayed.
Could someone help me to achieve this ?
Thanks. Guillaume B.