global $wpdb;
                    $query_array = array($post_id, $selected_start_range, $selected_end_range, '%' . $search_term . '%', '%' . $search_term . '%');
                    $found_comments = $wpdb->get_results($wpdb->prepare("\n                    SELECT *\n                    FROM {$wpdb->comments}\n                    WHERE comment_post_id = %d\n                    AND comment_date >= %s\n                    AND comment_date <= %s\n                    AND (comment_content LIKE %s OR comment_author LIKE %s)\n                    ", $query_array));
                    return_comment_list($found_comments);
                } else {
                    global $wpdb;
                    $query_array = array($post_id, $start_date . ' 00:00:00', $end_date . ' 23:59:59', '%' . $search_term . '%', '%' . $search_term . '%');
                    $found_comments = $wpdb->get_results($wpdb->prepare("\n                    SELECT *\n                    FROM {$wpdb->comments}\n                    WHERE comment_post_id = %d\n                    AND comment_date >= %s\n                    AND comment_date <= %s\n                    AND (comment_content LIKE %s OR comment_author LIKE %s)\n                    ", $query_array));
                    return_comment_list($found_comments);
                }
            }
        }
    }
}
if ($reset_results) {
    global $wpdb;
    $query_array = array($post_id);
    $found_comments = $wpdb->get_results($wpdb->prepare("\n                SELECT *\n                FROM {$wpdb->comments}\n                WHERE comment_post_id = %d\n                ", $query_array));
    return_comment_list($found_comments);
}
/**
 * Function takes sql result, turns to array and passes to modified wp_list_comments
 */
function return_comment_list($found_comments)
{
    $comments_to_add = [];
    foreach ($found_comments as $comment) {
        array_push($comments_to_add, $comment);
    }
    wp_list_comments(['style' => 'ol', 'short_ping' => true, 'callback' => 'bcgov_comments'], $comments_to_add);
}
Example #2
0
<h2>Recent observations</h2>
<?php 
require_once 'php_scripts/function_observation_list.php';
require_once 'php_scripts/tabular_data_functions.php';
echo return_observation_list($dbc, 3, '', '');
?>
<h2>Recent pictures</h2>
<?php 
require_once 'php_scripts/function_picture_list.php';
echo return_picture_list($dbc, 3, '', '');
?>
<div class="clear"></div> 
<h2>Recent comments</h2>
<?php 
require_once 'php_scripts/function_comment_list.php';
echo return_comment_list($dbc, 5, 'picture', 'recent', $picture_id, '', false);
?>
<p class="rss">
	<a href="rss.php">rss</a>
</p>
Example #3
0
    echo '</tr>' . "\n";
}
//echo '<tr>' . "\n" . '<td>Messier List</td>' . "\n";
//echo '<td><div class="stat_bar"><div style="width:' . round($observation_data['unique_observations_lists']['messier']['seen']/mysqli_num_rows($table_id)*100, 2) . '%;"><span>' . $observation_data['unique_observations_lists']['messier']['seen'] . '/' . mysqli_num_rows($table_id) . '</span></div></div></td>' . "\n";
//echo '</tr>' . "\n";
/*echo '<td>' . count($observation_data['unique_observations_by_type']) . '</td><td>';
	for($i=0;$i<count($observation_data['unique_observations_by_type']);$i++){
		echo $observation_data['unique_observations_by_type'][$i];
	}*/
?>
</table>
<h2>Recent Observations</h2>
<?php 
require_once 'php_scripts/function_observation_list.php';
echo return_observation_list($dbc, 5, $user_id, 'user');
?>
<h2>Recent Pictures</h2>
<div class="pictures">
<?php 
require_once 'php_scripts/function_picture_list.php';
echo return_picture_list($dbc, 3, $user_id, 'user');
?>
</div>
<h2>Recent Comments</h2>
<?php 
require_once 'php_scripts/function_comment_list.php';
echo return_comment_list($dbc, 3, 'picture', 'recent', $user_id, 'user', false);
?>
<h2>Marked Objects</h2>
<?php 
echo return_astronomical_objects_list($dbc, 'marked', $user_id);
Example #4
0
?>

<h2>Objects on this Picture</h2>

<?php 
require_once 'php_scripts/function_astronomical_objects_list.php';
$picture_objects = return_astronomical_objects_list($dbc, 'picture', $picture_id);
if ($picture_objects != false) {
    echo $picture_objects;
} else {
    echo '<p>No objects on this picture</p>';
}
?>
<h2>Comments</h2>
<?php 
require_once 'php_scripts/function_comment_list.php';
if (isset($_SESSION['user_id'])) {
    echo return_comment_list($dbc, 10, 'picture', null, $picture_id, 'picture', true);
} else {
    echo return_comment_list($dbc, 10, 'picture', null, $picture_id, 'picture', false);
}
?>

<h2>Facebook Comments</h2>
<div id="fb-root">
</div>
<script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&amp;xfbml=1"></script>
<fb:comments href="http://astro.nielsriekert.nl/?p=<?php 
echo $_GET['p'] . '&amp;picture_id=' . $picture_id;
?>
" num_posts="20" width="770"></fb:comments>