function ccgn_options_menu() { ?> <li <?php if (ccgn_is_home()) { ?> class="current"<?php } ?> ><a href="<?php echo ccgn_get_home_permalink(); ?> ">Narratives</a> </li> <?php if (ccgn_current_user_can_post()) { ?> <li <?php if (ccgn_is_post_edit()) { ?> class="current"<?php } ?> ><a href="<?php echo ccgn_get_home_permalink(); ?> /edit">Create New Narrative</a> </li> <?php } ?> <?php }
} else { ?> <div id="message" class="info"> <p><?php _e('That post does not appear to exist.', 'bcg'); ?> </p> </div> <?php } // BuddyPress forces comments closed on BP pages. Put the filter back. add_filter('comments_open', 'bp_comments_open', 10, 2); } else { if (ccgn_is_post_edit()) { ccgn_get_post_form(bp_get_group_id()); } else { // Must be the narrative list ?> <!-- This is the narrative list template, narrative list portion. --> <?php $q = new WP_Query(ccgn_get_query()); ?> <?php if ($q->have_posts()) { ?> <?php do_action('bp_before_group_blog_content'); ?>
/** * Change what populates the "link to existing content" box in the wp_editor instance. * * @since 1.1 * * @uses apply_filters() * @return string */ function filter_link_suggestions($results, $query) { if (!ccgn_is_post_edit()) { return $results; } // We're replacing the suggestions, so start with a blank slate. $results = array(); // Fetch allowable bp_docs, maps, reports $docs = ccgn_get_shareable_docs(); $maps = ccgn_get_shareable_maps_reports($group_id = null, $type = 'map'); $reports = ccgn_get_shareable_maps_reports($group_id = null, $type = 'report'); $results = array_merge($docs, $maps, $reports); // Sort the results by datetime, descending // Create the sort column array for array_multisort to use foreach ($results as $key => $value) { $datetime[$key] = $value['datetime']; } // Add $results as the last parameter, to sort by the common key array_multisort($datetime, SORT_DESC, $results); // Oh, handle search terms if included. Not awesome (doesn't search content). if (isset($query['keyphrase'])) { $found = array(); foreach ($results as $result) { if (stripos($result['title'], $query['keyphrase']) !== false) { $found[] = $result; } } $results = $found; } // Return the correct records, based on the query. $results = array_slice($results, $query['offset'], $query['posts_per_page']); // $towrite = PHP_EOL . 'results' . print_r($results, TRUE); // $towrite .= PHP_EOL . 'query' . print_r($query, TRUE); // $fp = fopen('link-to.txt', 'a'); // fwrite($fp, $towrite); // fclose($fp); return $results; }