Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('admin_menu', 'add_auxiliary_menu');
- add_action("wp_ajax_callbackFunction","callbackFunction");
- add_action("wp_ajax_nopriv_callbackFunction","callbackFunction");
- function add_auxiliary_menu()
- {
- add_menu_page(
- 'TB',
- '<span style="color:#e57300;">Thickbox</span>',
- 'edit_pages',
- 'thickbox-press-this',
- 'menu_page_content',
- '', // icon default for empty
- 1 // create before Dashboard menu item
- );
- }
- function menu_page_content()
- {
- ?>
- <div id="icon-post" class="icon32"></div>
- <h2>Press-This in a Thickbox</h2>
- <div style="width:50%; padding: 5px;" class="updated" >
- <p><a class="button-secondary" href="#" id="open-tb"><?php _e( 'Press not this' ); ?></a></p>
- </div>
- <p><?php echo_users(false); ?></p>
- <script type="text/javascript">
- jQuery(document).ready(function($) {
- $("#open-tb").click(function() {
- $.post("<?php echo admin_url("admin-ajax.php"); ?>", {"action": "callbackFunction"}, function(response) {
- console.dir(response);
- });
- });
- });
- </script>
- <?php
- }
- function callbackFunction(){
- echo_users();
- die();
- }
- function echo_users($ajax=true)
- {
- $blogusers = get_users();
- $br = $ajax ? '|' : '<br/>';
- foreach ($blogusers as $user) {
- echo $user->user_email.$br;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement