public function register_config_groups()
 {
     wp_register_script('peepso-blogposts-config', plugin_dir_url(__FILE__) . '../assets/js/blogposts-config.js', array('jquery'), PeepSo::PLUGIN_VERSION, TRUE);
     wp_enqueue_script('peepso-blogposts-config');
     if (isset($_GET['admin_tutorial_reset'])) {
         delete_user_meta(PeepSo::get_user_id(), 'peepso_blogposts_admin_tutorial_hide');
         PeepSo::redirect(admin_url() . 'admin.php?page=peepso_config&tab=blogposts');
     }
     if (isset($_GET['admin_tutorial_hide'])) {
         add_user_meta(PeepSo::get_user_id(), 'peepso_blogposts_admin_tutorial_hide', 1, TRUE);
         PeepSo::redirect(admin_url() . 'admin.php?page=peepso_config&tab=blogposts');
     }
     // display the admin tutorial unless this user has already hidden it
     if (1 != get_user_meta(PeepSo::get_user_id(), 'peepso_blogposts_admin_tutorial_hide', TRUE)) {
         ob_start();
         PeepSoTemplate::exec_template('blogposts', 'admin_tutorial');
         $peepso_admin = PeepSoAdmin::get_instance();
         $peepso_admin->add_notice(ob_get_clean(), '');
     }
     $this->context = 'left';
     $this->group_profile();
     $this->group_acknowledgements();
     $this->context = 'right';
     $this->group_activity();
     $this->group_post_types();
 }
echo apply_filters('peepso_user_profile_id', 0);
?>
"
						onchange="peepso.blogposts.sortby(this.value);">
					<option value="desc"><?php 
_e('Newest first', 'peepso');
?>
</option>
					<option value="asc"><?php 
_e('Oldest first', 'peepso');
?>
</option>
				</select>
			</div>

			<div class="clearfix mb-20"></div>
			<div class="ps-gallery ps-js-blogposts ps-js-blogposts--<?php 
echo apply_filters('peepso_user_profile_id', 0);
?>
"></div>
			<div class="ps-gallery-scroll ps-js-blogposts-triggerscroll ps-js-blogposts-triggerscroll--<?php 
echo apply_filters('peepso_user_profile_id', 0);
?>
">&nbsp;</div>

		</section><!--end component-->
	</section><!--end mainbody-->
</div><!--end row-->
<?php 
PeepSoTemplate::exec_template('activity', 'dialogs');
    /**
     * Build AJAX response with user blog posts
     */
    public function ajax_user_posts()
    {
        ob_start();
        $input = new PeepSoInput();
        $owner = $input->post_int('user_id');
        $page = $input->post_int('page', 1);
        $sort = $input->post('sort', 'desc');
        $blogposts_per_page = intval(PeepSo::get_option('site_activity_posts', 10));
        $offset = ($page - 1) * $blogposts_per_page;
        if ($page < 1) {
            $page = 1;
            $offset = 0;
        }
        $args = array('author' => $owner, 'orderby' => 'post_date', 'post_status' => 'publish', 'order' => $sort, 'posts_per_page' => $blogposts_per_page, 'offset' => $offset);
        // Count published posts
        $count_posts = wp_count_posts();
        $count_blogposts = $count_posts->publish;
        // Get the posts
        $blogposts = get_posts($args);
        if (count($blogposts)) {
            // Iterate posts
            foreach ($blogposts as $post) {
                // Choose between excerpt or post_content
                // @todo is there a more elegant way?
                $post_content = get_the_excerpt($post->ID);
                if (!strlen($post_content)) {
                    $post_content = $post->post_content;
                }
                $limit = intval(PeepSo::get_option('blogposts_profile_content_length', 50));
                $post_content = wp_trim_words($post_content, $limit, '&hellip;');
                if (0 == $limit) {
                    $post_content = FALSE;
                }
                // date positon
                $date_position = PeepSo::get_option('blogposts_profile_date_position', 'top');
                // image position
                $image_position = PeepSo::get_option('blogposts_profile_featured_image_position', 'top');
                // Featured image
                // @todo make this a template file?
                if (PeepSo::get_option('blogposts_profile_featured_image_enable') && (has_post_thumbnail($post) || PeepSo::get_option('blogposts_profile_featured_image_enable_if_empty'))) {
                    ob_start();
                    ?>

					<div style="background: url('<?php 
                    echo get_the_post_thumbnail_url($post);
                    ?>
');" class="ps-blogposts-featured-image ps-blogposts-featured-image-<?php 
                    echo $image_position;
                    ?>
"></div>

					<?php 
                    $image = ob_get_clean();
                }
                $args = compact('post_content', 'date_position', 'image_position', 'image', 'post');
                if (PeepSo::get_option('blogposts_profile_two_column_enable', 0)) {
                    PeepSoTemplate::exec_template('blogposts', 'blogpost_half', $args);
                } else {
                    PeepSoTemplate::exec_template('blogposts', 'blogpost_wide', $args);
                }
            }
        } else {
            // @todo message when nothing found
        }
        $resp['success'] = 1;
        $resp['page'] = $page;
        $resp['found_blogposts'] = abs($count_blogposts - $page * $blogposts_per_page);
        $resp['html'] = ob_get_clean();
        header('Content-Type: application/json');
        echo json_encode($resp);
        exit(0);
    }