use this
//$pages=wp_list_pages($args);
$parents = get_post_ancestors( $post->ID );
$id = ($parents) ? $parents[count($parents)-1]: $post->ID;
$args = array(
'order' => $sort_order,
'post_parent' => $id,
'post_status' => 'publish',
'post_type' => 'page',
);
$attachments = get_children( $args );
foreach($attachments as $attachment)
{ if(($attachment->post_title != $thispagetitle)): ?>
<li><a href="<?php echo $attachment->guid;?>"><?php echo $attachment->post_title;?></a></li>
<?php endif;
}
print_r($pages);
under else when checking if($attachments)
in the file plugin_list_subpages.php