Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mathieu Viet

    (@imath)

    Hi, if i understand well: you are looking for a way to display the latest idea a member posted inside the BuddyPress members loop.

    here’s how you could do :

    function natty_latest_idea_in_members_directory() {
    	// Ideally, there should be a cache strategy to improve performance.
    	$idea = wp_idea_stream_ideas_get_ideas( array(
    		'author'   => bp_get_member_user_id(),
    		'per_page' => 1,
    	) );
    
    	if ( empty( $idea['ideas'] ) ) {
    		return;
    	}
    
    	$latest_idea = reset( $idea['ideas'] );
    
    	if ( ! is_a( $latest_idea, 'WP_Post' ) ) {
    		return;
    	}
    
    	// always use this function to build the idea permalink!
    	$latest_idea_link = wp_idea_stream_ideas_get_idea_permalink( $latest_idea );
    	?>
    	<p>Latest idea: <a href="<?php echo esc_url( $latest_idea_link );?>" title="<?php echo esc_attr( $latest_idea->post_title );?>"><?php echo esc_html( $latest_idea->post_title );?></a></p>
    	<?php
    }
    add_action( 'bp_directory_members_item', 'natty_latest_idea_in_members_directory' );

    You must know this will bring you some overload in the display of the members directory. There should be a cache strategy to avoid to request for posts at each member. So i think, i wouldn’t advise you to use this as is, but i would advise you to ask a WordPress/BuddyPress developer to build the feature so that it doesn’t overload too much the loading of this specific page.

    Thread Starter _natty_

    (@_natty_)

    great I will try it asap! and I will try to learn about caching… nice plugin indeed!

    Thread Starter _natty_

    (@_natty_)

    I’ve one more question for you, and I don’t know if is better to open a new post.
    Anyway:

    I’ve a problem with the list of all ideas from all user, the page template broke my header from my theme, but is supported from the other pages ( new idea, my-ideas).
    So I put on my theme’s folder like you suggest here
    https://github.com/imath/wp-idea-stream/wiki/Ways-to-customize-the-plugin-from-your-theme
    the structure of folders:
    /wp-idea-stream/templates
    and then I’ve tried to edit the archive.php page, but nothin happen, it seems that the template isn’t used!
    where I wrong? or I’ve to edit some other page or parts?

    thanks again

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how can I show Idea's title on members list bbp’ is closed to new replies.