if (!isset($shub_account_id) || !isset($shub_message_id)) { exit; } ?> <?php if ($shub_account_id && $shub_message_id) { $bbpress = new shub_bbpress_account($shub_account_id); if ($shub_account_id && $bbpress->get('shub_account_id') == $shub_account_id) { $bbpress_message = new shub_bbpress_message($bbpress, false, $shub_message_id); $bbpress_message->output_message_page('popup'); } } if ($shub_account_id && !(int) $shub_message_id) { $bbpress = new shub_bbpress_account($shub_account_id); if ($shub_account_id && $bbpress->get('shub_account_id') == $shub_account_id) { /* @var $groups shub_bbpress_item[] */ $groups = $bbpress->get('groups'); //print_r($groups); ?> <form action="" method="post" enctype="multipart/form-data"> <input type="hidden" name="_process" value="send_bbpress_message"> <?php wp_nonce_field('send-bbpress' . (int) $bbpress->get('shub_account_id')); ?> <?php $fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Compose message'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array('item' => array('title' => __('bbpress Group', 'support_hub'), 'fields' => array()), 'message' => array('title' => __('message', 'support_hub'), 'field' => array('type' => 'textarea', 'name' => 'message', 'id' => 'bbpress_compose_message', 'value' => '')), 'type' => array('title' => __('Type', 'support_hub'), 'fields' => array('<input type="radio" name="post_type" id="post_type_wall" value="wall" checked> ', '<label for="post_type_wall">', __('Wall Post', 'support_hub'), '</label>', '<input type="radio" name="post_type" id="post_type_link" value="link"> ', '<label for="post_type_link">', __('Link Post', 'support_hub'), '</label>', '<input type="radio" name="post_type" id="post_type_picture" value="picture"> ', '<label for="post_type_picture">', __('Picture Post', 'support_hub'), '</label>')), 'link' => array('title' => __('Link', 'support_hub'), 'fields' => array(array('type' => 'text', 'name' => 'link', 'id' => 'message_link_url', 'value' => ''), '<div id="bbpress_link_loading_message"></div>', '<span class="bbpress-type-link bbpress-type-option"></span>')), 'link_picture' => array('title' => __('Link Picture', 'support_hub'), 'fields' => array(array('type' => 'text', 'name' => 'link_picture', 'value' => ''), 'Full URL (eg: http://) to the picture to use for this link preview', '<span class="bbpress-type-link bbpress-type-option"></span>')), 'link_name' => array('title' => __('Link Title', 'support_hub'), 'fields' => array(array('type' => 'text', 'name' => 'link_name', 'value' => ''), 'Title to use instead of the automatically generated one from the Link page', '<span class="bbpress-type-link bbpress-type-option"></span>')), 'link_caption' => array('title' => __('Link Caption', 'support_hub'), 'fields' => array(array('type' => 'text', 'name' => 'link_caption', 'value' => ''), 'Caption to use instead of the automatically generated one from the Link page', '<span class="bbpress-type-link bbpress-type-option"></span>')), 'link_description' => array('title' => __('Link Description', 'support_hub'), 'fields' => array(array('type' => 'text', 'name' => 'link_description', 'value' => ''), 'Description to use instead of the automatically generated one from the Link page', '<span class="bbpress-type-link bbpress-type-option"></span>')), 'picture' => array('title' => __('Picture', 'support_hub'), 'fields' => array('<input type="file" name="picture" value="">', '<span class="bbpress-type-picture bbpress-type-option"></span>')), 'schedule' => array('title' => __('Schedule', 'support_hub'), 'fields' => array(array('type' => 'date', 'name' => 'schedule_date', 'value' => ''), array('type' => 'time', 'name' => 'schedule_time', 'value' => ''), ' ', sprintf(__('Currently: %s', 'support_hub'), date('c')), ' (Leave blank to send now, or pick a date in the future.)')), 'debug' => array('title' => __('Debug', 'support_hub'), 'field' => array('type' => 'check', 'name' => 'debug', 'value' => '1', 'checked' => false, 'help' => 'Show debug output while posting the message')))); foreach ($groups as $item_id => $group) { $fieldset_data['elements']['item']['fields'][] = '<div id="bbpress_compose_group_select">' . '<input type="checkbox" name="compose_group_id[' . $item_id . ']" value="1" checked> ' . '<img src="//graph.bbpress.com/' . $item_id . '/picture"> ' . htmlspecialchars($group->get('item_name')) . '</div>'; }
public function run_cron($debug = false) { if ($debug) { echo "Starting bbpress Cron Job \n"; } $accounts = $this->get_accounts(); foreach ($accounts as $account) { $shub_bbpress_account = new shub_bbpress_account($account['shub_account_id']); $shub_bbpress_account->run_cron($debug); $forums = $shub_bbpress_account->get('items'); /* @var $forums shub_bbpress_item[] */ foreach ($forums as $forum) { $forum->run_cron($debug); } } if ($debug) { echo "Finished bbpress Cron Job \n"; } }
} ?> </p> </form> </div> <?php } } } else { // show account overview: $myListTable = new SupportHub_Account_Data_List_Table(); $accounts = $shub_bbpress->get_accounts(); foreach ($accounts as $account_id => $account) { $a = new shub_bbpress_account($account['shub_account_id']); $accounts[$account_id]['edit_link'] = $a->link_edit(); $accounts[$account_id]['title'] = $a->get('account_name'); $accounts[$account_id]['last_checked'] = $a->get('last_checked') ? shub_print_date($a->get('last_checked')) : 'N/A'; } $myListTable->set_data($accounts); $myListTable->prepare_items(); ?> <div class="wrap"> <h2> <?php _e('bbPress Accounts', 'support_hub'); ?> <a href="?page=<?php echo esc_attr($_GET['page']); ?>