WordPress.org

Ready to get started?Download WordPress

Forums

User Specific Content
[resolved] Controlling BuddyPress-generated pages (2 posts)

  1. Bat-n-Ball
    Member
    Posted 2 years ago #

    Hello and thanks for a superb Plugin :o)

    BuddyPress uses regular blank WordPress Pages with a Title only, such as Activity, Forums, Groups and so on and then generates appropriate content for those pages.

    Unfortunately, User Specific Content does not seem to work with these 'generated' pages :o(

    Shortcode, or selecting users from the 'User specific content box' works on all my pages but not the BuddyPress pages.

    Is there any work-around to this little problem?

    I was looking at maybe inserting shortcode into the appropriate buddypress .php file:
    http://wp-cms.com/template-development/inserting-wordpress-shortcode-outside-the-loop-in-a-template/
    ... but am unsure of which file to edit.

    Any help would be greatly welcomed.

    Kind regards,

    Paul.

    http://wordpress.org/extend/plugins/user-specific-content/

  2. Bainternet
    Member
    Plugin Author

    Posted 2 years ago #

    the plugin is named user specific content so its made to work with posts or pages content. You can make it work with anything you want using the shortcode in your template files, or by using the plugins main class and it's methods.

    here is an example of how you can use the plugins class methods in your theme to make comments user specific :

    <?php
    //get comments and comment form as a var
    global $post;
    $comments = get_comments('post_id='.$post->ID);
    $com = '';
    foreach($comments as $comment) :
        $com .= '<div class="com_container">
            <div class="com_author">'.$comment->comment_author . '</div>
            <div class="com_content">' . $comment->comment_content.'</div>
            </div>';
    endforeach;
    ob_start();
    comment_form();
    $com .= '<div class="com_form">'.ob_get_contents().'</div>';
    ob_end_clean();    
    
    //here you have two options, either to set the shortcode manually for each page:
    //$com = '[O_U user_id="1,2,3" blocked_meassage="comments are closed for everyone!"]'. $com .'[/O_U]';
    //then run it by the shortcode
    //echo do_shortcode($com);
    
    //or you can create a new instance of the plugin class and let it use the same sattings as the content on that page:
    $limit_C = new bainternet_U_S_C();
    echo $limit_C->User_specific_content_filter($com);
    ?>

    you can do the same on BuddyPress Activity, Forums, Groups or whatever, you just need to find the right file you your theme to edit.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic