public function output_message_page($type = 'inline')
    {
        $message_id = $this->get('shub_message_id');
        if ($message_id && $this->get('shub_account_id')) {
            if ('popup' == $type) {
                $this->mark_as_read();
            }
            // icon for this account.
            $icons = SupportHub::getInstance()->message_managers[$this->network]->get_friendly_icon('shub_message_account_icon');
            // icon for the linked product
            $shub_product_id = $this->get_product_id();
            $product_data = array();
            $item_data = array();
            $bbpress_item = $this->get('item');
            if (!$shub_product_id && $bbpress_item) {
                $shub_product_id = $bbpress_item->get('shub_product_id');
                $item_data = $bbpress_item->get('item_data');
                if (!is_array($item_data)) {
                    $item_data = array();
                }
            }
            if ($shub_product_id) {
                $shub_product = new SupportHubProduct();
                $shub_product->load($shub_product_id);
                $product_data = $shub_product->get('product_data');
            }
            if ($shub_product_id && !empty($product_data['image'])) {
                if (!empty($product_data['url'])) {
                    $icons .= '<a href="' . esc_attr($product_data['url']) . '" target="_blank">';
                }
                $icons .= '<img src="' . esc_attr($product_data['image']) . '" class="shub_message_account_icon">';
                if (!empty($product_data['url'])) {
                    $icons .= '</a>';
                }
            }
            ?>

            <div class="message_edit_form" data-network="<?php 
            echo $this->network;
            ?>
">
                <section class="message_sidebar">
                    <nav>
                        <?php 
            if ($this->get('shub_status') == _shub_MESSAGE_STATUS_ANSWERED) {
                ?>
                            <a href="#" class="shub_message_action btn btn-default btn-xs button shub_button_loading"
                               data-action="set-unanswered" data-post="<?php 
                echo esc_attr(json_encode(array('network' => $this->network, 'shub_message_id' => $message_id, 'last_activity' => $this->get('last_active'))));
                ?>
"><?php 
                _e('Inbox');
                ?>
</a>
                        <?php 
            } else {
                ?>
                            <a href="#" class="shub_message_action btn btn-default btn-xs button shub_button_loading"
                               data-action="set-answered" data-post="<?php 
                echo esc_attr(json_encode(array('network' => $this->network, 'shub_message_id' => $message_id, 'last_activity' => $this->get('last_active'))));
                ?>
"><?php 
                _e('Archive');
                ?>
</a>
                        <?php 
            }
            ?>
                        <span class="responsive_sidebar_summary">
                        <?php 
            echo $icons;
            // todo - what other details need to show in mobile view?
            ?>
                        </span>

                        <a href="#" class="shub_view_full_message_sidebar btn btn-default btn-xs button alignright"><?php 
            _e('More Details');
            ?>
</a>
                    </nav>
                    <header>
                        <a href="<?php 
            echo $this->get_link();
            ?>
" class="social_view_external btn btn-default btn-xs button" target="_blank"><?php 
            _e('View Comment');
            ?>
</a>
                        <?php 
            if ($this->get('shub_status') == _shub_MESSAGE_STATUS_ANSWERED) {
                ?>
                            <a href="#" class="shub_message_action btn btn-default btn-xs button shub_button_loading"
                               data-action="set-unanswered" data-post="<?php 
                echo esc_attr(json_encode(array('network' => $this->network, 'shub_message_id' => $message_id, 'last_activity' => $this->get('last_active'))));
                ?>
"><?php 
                _e('Inbox');
                ?>
</a>
                        <?php 
            } else {
                ?>
                            <a href="#" class="shub_message_action btn btn-default btn-xs button shub_button_loading"
                               data-action="set-answered" data-post="<?php 
                echo esc_attr(json_encode(array('network' => $this->network, 'shub_message_id' => $message_id, 'last_activity' => $this->get('last_active'))));
                ?>
"><?php 
                _e('Archive');
                ?>
</a>
                        <?php 
            }
            ?>
                    </header>
                    <aside class="message_sidebar">
                        <?php 
            echo $icons;
            echo '<br/>';
            // this method does all the magic of getting the linked user ids and other messages
            $data = $this->get_message_sidebar_data($product_data, $item_data);
            if (!empty($data['message_details'])) {
                ?>
                            <div class="message_sidebar_details">
                            <?php 
                foreach ($data['message_details'] as $message_details) {
                    ?>
                                <div>
                                    <strong><?php 
                    echo htmlspecialchars($message_details[0]);
                    ?>
:</strong>
                                    <?php 
                    echo $message_details[1];
                    ?>
                                </div>
                                <?php 
                }
                ?>
                            </div>
                            <?php 
            }
            if (!empty($data['extra_datas'])) {
                ?>
                            <div class="message_sidebar_extra_data">
                            <?php 
                foreach ($data['extra_datas'] as $extra_data) {
                    if (isset($extras[$extra_data->get('shub_extra_id')])) {
                        ?>
                                    <div>
                                        <strong><?php 
                        echo htmlspecialchars($extras[$extra_data->get('shub_extra_id')]->get('extra_name'));
                        ?>
:</strong>
                                        <?php 
                        switch ($extras[$extra_data->get('shub_extra_id')]->get('field_type')) {
                            case 'encrypted':
                                echo '(encrypted)';
                                break;
                            default:
                                echo shub_forum_text($extra_data->get('extra_value'), false);
                        }
                        ?>
                                    </div>
                                    <?php 
                    }
                }
                ?>
                            </div>
                            <?php 
            }
            if (!empty($data['user_bits'])) {
                ?>
                            <ul class="linked_user_details"> <?php 
                foreach ($data['user_bits'] as $user_bit) {
                    ?>
                                    <li><strong><?php 
                    echo $user_bit[0];
                    ?>
:</strong> <?php 
                    echo $user_bit[1];
                    ?>
</li>
                                    <?php 
                }
                ?>
                            </ul>
                            <?php 
            }
            if (!empty($data['other_messages'])) {
                ?>
                            <div class="shub_other_messages">
                                <strong><?php 
                echo sprintf(_n('%d Other Message:', '%d Other Messages:', count($data['other_messages']), 'support_hub'), count($data['other_messages']));
                ?>
</strong><br/>
                                <ul>
                                    <?php 
                foreach ($data['other_messages'] as $other_message) {
                    ?>
                                        <li>
                                            <span class="other_message_time"><?php 
                    echo shub_pretty_date($other_message['time']);
                    ?>
</span>
                                            <span class="other_message_status"><?php 
                    if (isset($other_message['message_status'])) {
                        switch ($other_message['message_status']) {
                            case _shub_MESSAGE_STATUS_ANSWERED:
                                echo '<span class="message_status_archived">Archived</span>';
                                break;
                            case _shub_MESSAGE_STATUS_UNANSWERED:
                                echo '<span class="message_status_inbox">Inbox</span>';
                                break;
                            case _shub_MESSAGE_STATUS_HIDDEN:
                                echo '<span class="message_status_hidden">Hidden</span>';
                                break;
                            default:
                                echo 'UNKNOWN?';
                        }
                    }
                    ?>
                                            </span>
                                            <span class="other_message_network">
                                                <?php 
                    echo $other_message['icon'];
                    ?>
                                            </span>
                                            <br/>
                                            <a href="<?php 
                    echo esc_attr($other_message['link']);
                    ?>
" target="_blank" class="shub_modal"
                                               data-network="<?php 
                    echo esc_attr($other_message['network']);
                    ?>
"
                                               data-message_id="<?php 
                    echo (int) $other_message['message_id'];
                    ?>
"
                                               data-message_comment_id="<?php 
                    echo isset($other_message['message_comment_id']) ? (int) $other_message['message_comment_id'] : '';
                    ?>
"
                                               data-modaltitle="<?php 
                    echo esc_attr($other_message['summary']);
                    ?>
"><?php 
                    echo esc_html($other_message['summary']);
                    ?>
</a>
                                        </li>
                                        <?php 
                }
                ?>
                                </ul>
                                </div>
                            <?php 
            }
            do_action('supporthub_message_header', $this->network, $this);
            ?>

                    </aside>
                </section>
                <section class="message_content">
                    <?php 
            // we display the first "primary" message (from the ucm_message table) followed by comments from the ucm_message_comment table.
            //$this->full_message_output(true);
            $this->output_message_list();
            ?>
                </section>
                <section class="message_request_extra">
                    <?php 
            SupportHubExtra::form_request_extra(array('network' => $this->network, 'account-id' => $this->get('shub_account_id'), 'message-id' => $message_id));
            ?>
                </section>
            </div>

        <?php 
        }
    }