Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm creating a new page in WordPress admin for a theme. In this new page will be a list of people registered (in a form), but with few details / information. So when a person clicks on something, I would like to open a "pop-up" (with all information) but not display this popup/page in the menus of the WordPress administration. Is there any way?

share|improve this question
add comment

2 Answers

You can use the built in ThickBox to display the popup by Ajax:

//first add thickbox to your page
function add_thickbox(){
    if(is_admin() && (isset($_GET['page']) && $_GET['page'] == "my-plugin-file.php") { 
    wp_enqueue_script('jquery');
    wp_enqueue_script('thickbox',null,array('jquery'));
    wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');
    }
}
add_action('wp_enqueue_script','add_thickbox');


//then in your user list for each user you add the thickbox 
//popup on the onclick and pass the info needed (like user id) so eg:

?>
<!-- for each user add -->
 <a class="thickbox" onclick="javascript: show_user_info(user_id)">user name</a>
<!-- and then add this function once --> 
<script>
function show_user_info(user_id){
    var aj_url = 'admin-ajax.php?action=my_get_user_info&user_id=' + user_id;
    tb_show('userinfo',aj_url );
}
</script>

<?php 
//so all you have left is to create the ajax processing function :
add_action('wp_ajax_my_get_user_info', 'my_AJAX_processing_function');
function my_AJAX_processing_function(){
    //echo user info 
    //and remember to die;  
}
share|improve this answer
    
great solution! I will try this! but do you have no idea a way to load a admin page in wordpress without menus? –  Matheus Eduardo Aug 10 '11 at 14:39
    
You can load different views in the same page by adding get parameters –  Bainternet Aug 10 '11 at 14:43
add comment

I would think you could add a css class to the body of that new admin page using a wordpress filter, then use css to hide the unwanted items within the page.

http://stackoverflow.com/questions/2466073/add-a-custom-class-name-to-wordpress-body-tag

share|improve this answer
1  
it's a good alternative solution, but I still want to no "load" html code, etc. no proccess the menu, not just visual. –  Matheus Eduardo Aug 10 '11 at 14:38
    
Yes... the above solution is definitely better. I misunderstand you intentions on first glance. –  gruvii Aug 16 '11 at 20:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.