Skip to content

Instantly share code, notes, and snippets.

@williamsba
Created January 14, 2013 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williamsba/4532705 to your computer and use it in GitHub Desktop.
Save williamsba/4532705 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: BadgeOS DMA Print
* Plugin URI: http://WebDevStudios.com
* Description: Custom class for DMA printing
* Version: 1.0
* Author: WebDevStudios
* Author URI: http://WebDevStudios.com
*/
// Hook our ID printer to the custom user registration
// Note: $username is our DMA Friends ID (e.g. FR00000000)
add_action( 'dma_user_registration', 'dma_print_user_id', 10, 3 );
function dma_print_user_id( $last_name, $username, $location_printer_ip ) {
require_once( 'poc/dmaprint.class.php' );
$idcard = new dmaprintid( $last_name, $username, $location_printer_ip );
$idcard->doPrint();
}
// create custom plugin settings menu
add_action( 'admin_menu', 'badgestack_dma_print_menu', 99 );
function badgestack_dma_print_menu() {
add_submenu_page( 'badgestack_badgestack', 'Print', 'Print', 'manage_options', 'badgestack_print_help', 'badgestack_dma_test_print' );
}
add_action( 'admin_init', 'badgeos_dma_test_print' );
function badgeos_dma_test_print() {
if ( isset( $_POST['test_print'] ) ) {
dma_print_user_id( 1, $_POST['last_name'], $_POST['username'], $_POST['location_printer_ip'] );
}
}
function badgestack_dma_test_print() {
?>
<h2>Test ID Card Printing</h2>
<form method="post">
<input type="hidden" name="printtype" value="idcard" />
<label for="last_name">Name</label>
<input type="text" name="last_name"></input><br/>
<label for="username">User ID Number</label>
<input type="text" name="username"></input><br/>
<label for="location_printer_ip">Printer</label>
<input type="text" name="location_printer_ip" value="jprinter" /><br/>
<input type="submit" name="test_print" value="Print Test ID Card" />
</form>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment