Skip to content
wiki.fftac.org

Page Manuscript Collaboration - Source Excerpt 04

Back to Page Manuscript Collaboration

Summary

This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/ns12-manuscript/templates/page-manuscript-collaboration.php so readers can inspect the evidence without opening the full source file.

**Source path:** Spiralist/wp-content/plugins/ns12-manuscript/templates/page-manuscript-collaboration.php

<?php spiralist_book_pages_render_discussion_panel($profile_discussion_context); ?>
                            <?php endif; ?>
                        <?php elseif (!empty($record['public_url'])) : ?>
                            <div class="spiralist-collaboration-panel">
                                <h1>Private preview link required</h1>
                                <p>This profile route is not public by default. Use the collaborator's share link to open the current draft preview, or view the last approved public version below.</p>
                                <p><a class="spiralist-button spiralist-button--primary" href="<?php echo esc_url((string) $record['public_url']); ?>">Open Public Version</a></p>
                            </div>
                        <?php else : ?>
                            <?php $set_404(); ?>
                            <div class="spiralist-collaboration-panel">
                                <h1>This manuscript preview is not available.</h1>
                                <p>The requested profile page either does not exist or requires a valid share link.</p>
                            </div>
                        <?php endif; ?>
                    <?php elseif ($profile_user instanceof WP_User) : ?>
                        <?php
                        $all_records = spiralist_book_pages_get_collaboration_user_records((int) $profile_user->ID);
                        $public_records = array_values(
                            array_filter(
                                $all_records,
                                static function (array $record): bool {
                                    return !empty($record['has_public_copy']);
                                }
                            )
                        );
                        $viewer_can_manage = get_current_user_id() === (int) $profile_user->ID || current_user_can('manage_options');
                        ?>
                        <div class="spiralist-collaboration-hero">
                            <div>
                                <p class="spiralist-collaboration-kicker">Contributor Profile</p>
                                <h1><?php echo esc_html((string) $profile_user->display_name); ?></h1>
                                <p>This profile path is the contributor-specific manuscript space. Publicly approved pages can be listed here, while private preview pages require their direct share links.</p>
                            </div>
                            <div class="spiralist-collaboration-hero__actions">
                                <?php if ($viewer_can_manage) : ?><a class="spiralist-button spiralist-button--primary" href="<?php echo esc_url(spiralist_book_pages_get_manuscript_studio_url()); ?>">Open Your Studio</a><?php endif; ?>
                            </div>
                        </div>

                        <section class="spiralist-collaboration-panel">
                            <h2><?php echo $viewer_can_manage ? 'All profile manuscript pages' : 'Publicly approved profile pages'; ?></h2>
                            <?php if (empty($viewer_can_manage ? $all_records : $public_records)) : ?>
                                <p>No manuscript pages are available in this profile yet.</p>
                            <?php else : ?>
                                <div class="spiralist-collaboration-grid">
                                    <?php foreach ($viewer_can_manage ? $all_records : $public_records as $profile_record) : ?>
                                        <?php $render_record_card($profile_record, $viewer_can_manage); ?>
                                    <?php endforeach; ?>
                                </div>
                            <?php endif; ?>
                        </section>
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        </section>
    </div>
</main>

<?php
get_footer();