Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)

  • azchipka
    Participant

    @azchipka

    James (@fitnessblogger),

    If installing the beta doesn’t resolve the issue, I can take a look at it for you. Might be something silly thats different on your site.

    ~Avery


    azchipka
    Participant

    @azchipka

    @fitnessblogger and @4ella with out additional information on your configuration its hard for me to say what the issue is. The above code was written specifically to resolve the issue on one of my websites and its working perfectly there as provided above.

    Now that said its worth noting the site the code is being used on is running
    WordPress 3.6-beta3-24450. @4ella you mentioned you running the latest version of wordpress which if not the beta is 3.5.2 which 3.6 has some pretty major changes made to it so this could be part of the problem.


    azchipka
    Participant

    @azchipka

    I was looking for a simple solution for this function and couldn’t find one so I wrote it.

    You can download a bundled plugin by clicking here.


    azchipka
    Participant

    @azchipka

    I had the same issue and when I tried to install the plugin you mentioned it didn’t work.

    After waiting to hear back from the developer for awhile with out hearing back I just wrote my own. You can download a bundled plugin by clicking here.


    azchipka
    Participant

    @azchipka

    Use the download link the forum keeps stripping out a portion of the code.


    azchipka
    Participant

    @azchipka

    Sorry there was an error in the above code, that results in a no results dialog error for users who have no posts. You can download a bundled plugin by clicking here.

    if ( !function_exists( 'add_action' ) ) {
    	echo 'Hi there!  I\'m just a plugin, not much I can do when called directly.';
    	exit;
    }
    define('TCH_PostsOnProfilesVersion', '0.1');
    define('TCH_PostsOnProfilesVersion_PLUGIN_URL', plugin_dir_url( __FILE__ ));
    
    add_action( 'bp_setup_nav', 'add_profileposts_tab', 100 );
    function add_profileposts_tab() {
    global $bp;
    bp_core_new_nav_item( array(
    'name' => 'My Posts',
    'slug' => 'posts',
    'screen_function' => 'bp_postsonprofile',
    'default_subnav_slug' => 'My Posts', 
    'position' => 25
    )
    );
    // show feedback when 'Posts' tab is clicked
    function bp_postsonprofile() {
    add_action( 'bp_template_content', 'profile_screen_posts_show' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function profile_screen_posts_show() {
    $theuser = bp_displayed_user_id(); 
    query_posts("author=$theuser" );
    if ( have_posts() ) :
    get_template_part( 'loop', 'archive' );
    else: ?>
    
    		
    
    	    

    azchipka
    Participant

    @azchipka

    OK went through the plugin and updated the code to function in current versions of buddy press, its a bit sloppy but it does work. Just place the below code in your bp-custom.php file and it will add a new tab to each users profile that displays the blog posts they have written. Display is based off of your archive.php file so it matches the theme.

    //POSTS ON PROFILE STARTS HERE
    add_action( 'bp_setup_nav', 'add_profileposts_tab', 100 );
    function add_profileposts_tab() {
    global $bp;
    bp_core_new_nav_item( array(
    'name' => 'My Posts',
    'slug' => 'posts',
    'screen_function' => 'bp_postsonprofile',
    'default_subnav_slug' => 'My Posts', 
    'position' => 25
    )
    );
    // show feedback when 'Posts' tab is clicked
    function bp_postsonprofile() {
    add_action( 'bp_template_content', 'profile_screen_posts_show' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function profile_screen_posts_show() {
    $theuser = bp_displayed_user_id(); 
    query_posts("author=$theuser" );
    get_template_part( 'loop', 'archive' ); //call your archive template
    
    }
    
    }
    
    //POSTS ON PROFILE ENDS HERE

    azchipka
    Participant

    @azchipka

    Ok so I managed to find a backwards way of doing it because I needed to be able to do the same thing. Your going to need two plugins.

    1. Your Preferred Role Management Plugin. I like Capacity Manager Enhanced
    2. Buddypress xProfiles ACL

    STEPS
    1. Use your role manager to create some new roles. Name them what ever you want.
    2. Go into the Users -> Profile Fields
    3. Create a Field Group for your Restricted Items (not the primary one).
    4. Go to the Settings -> xProfile ACL
    5. Put your Field Group that you only want the Admin to be able to edit for the admin only.
    6. Now this is important you need to modify the xProfile ACL php file (yes I know this makes it a hack, if xProfile ACL is updated you will lose this setting.)
    6a. Go to line 240 of the buddypress-xprofiles-acl.php file. Comment out lines 240 – 249, the code you are commenting out is:

    `
    function filter_xprofile_groups_with_acl() {
    global $bp, $profile_template, $current_user;
    get_currentuserinfo();
    foreach($profile_template->groups as $key => $profile_group) {
    if( ! in_array($profile_group->id, $this->user_allowed_xprofile_groups) ) {
    unset($profile_template->groups[$key]);
    }
    }
    }
    `

    6b. Below the code you just commented out add:
    ` function filter_xprofile_groups_with_acl() {}`

    7. Save your changes to the buddypress-xprofiles-acl.php file.

    8. Now when ever you need to modify the fields log in with your admin account navigate to the user profile in buddy press and select Edit Member Profile from the tool bar. You will see the fields from the private group. Users will see the fields but when they select edit they will not be displayed.

    Hope this helps.


    azchipka
    Participant

    @azchipka

    @Chouf1 2.2.4


    azchipka
    Participant

    @azchipka

    Maybe I am missing something here but seems like what your looking at doing could be easily done with the following command:

    bp_displayed_user_email()

Viewing 10 replies - 1 through 10 (of 10 total)
Skip to toolbar