function foolic_get_licensekeys_by_user($user = false) { if (empty($user)) { $user = wp_get_current_user(); } $connected_licensekeys = get_posts(array('connected_type' => foolic_post_relationships::USER_TO_LICENSEKEYS, 'connected_items' => $user, 'post_count' => -1, 'suppress_filters' => false)); if ($connected_licensekeys) { $license_keys = array(); foreach ($connected_licensekeys as $licensekey) { $license_keys[] = foolic_licensekey::get($licensekey); } return $license_keys; } //no results - boo! return array(); }
function render_licensekey_details_metabox($post) { $license_key = foolic_licensekey::get($post); ?> <table class="form-table"> <tbody> <tr> <td style="width:150px" class="first-column" valign="top"><?php _e('Deactivated', 'foolic'); ?> </td> <td> <?php echo $license_key->deactivated ? "<strong style='color:#f00'>YES</strong>" : "no"; ?> <input name="<?php echo FOOLIC_CPT_LICENSE_KEY; ?> [deactivated]" type="checkbox" value="on" <?php echo $license_key->deactivated ? 'checked="checked"' : ''; ?> /> </td> <td style="width:150px" class="first-column" valign="top"><?php _e('Expires', 'foolic'); ?> </td> <td><input name="<?php echo FOOLIC_CPT_LICENSE_KEY; ?> [expires]" size="10" maxlength="20" type="text" value="<?php echo $license_key->expires; ?> " /></td> </tr> <tr> <td class="first-column" valign="top"><?php _e('Domain Limit', 'foolic'); ?> </td> <td><input name="<?php echo FOOLIC_CPT_LICENSE_KEY; ?> [domain_limit]" size="10" maxlength="4" type="text" value="<?php echo $license_key->domain_limit; ?> " /></td> <td class="first-column" valign="top"><?php _e('Domain Limit Exceeded', 'foolic'); ?> </td> <td> <?php echo $license_key->exceeded ? "<strong style='color:#f00'>YES</strong>" : "no"; ?> </td> </tr> <?php do_action('foolic_render_licensekey_details_metabox', $post); ?> </tbody> </table><?php }