-
Notifications
You must be signed in to change notification settings - Fork 0
/
wc-badge-generator.php
42 lines (37 loc) · 1008 Bytes
/
wc-badge-generator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Plugin Name: WordCamp Badge Generator
* Plugin URI: http://make.wordpress.org/community/
* Description: Generates badges for WordCamps.
* Author: George Stephanis
* Version: 0.1
* Author URI: http://stephanis.info/
*/
class WC_Badge_Generator {
public static function add_hooks() {
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
}
public static function admin_menu() {
$hook = add_submenu_page( 'edit.php?post_type=tix_ticket',
__( 'Badges' ),
__( 'Badges' ),
'manage_options',
'attendee_badges',
array( __CLASS__, 'badges_page' )
);
add_action( "load-{$hook}", array( __CLASS__, 'show_badges' ) );
}
public static function badges_page() {
echo 'Hrm, something went wrong. You shouldn\'t have gotten this far!';
}
public static function show_badges() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
include( 'badges.tpl.php' );
exit;
}
}
if ( is_admin() ) {
WC_Badge_Generator::add_hooks();
}