Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 3 years ago

Last modified 2 years ago

#6736 closed enhancement (no action required)

Allow users to create WP posts on Buddypress Profile

Reported by: Dono12 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.4.0
Component: Members Keywords: dev-feedback
Cc:

Description (last modified by boonebgorges)

Can the developers/contributors add a post on profile button to show user posts in the next update. It makes sense to have this function as it incorporates Wordpress and Buddypress respectively. There is only one plugin that I found which accomplished this feet:

<a href="https://wordpress.org/plugins/bp-posts-on-profile/">BP Posts On Profile</a>

by Huseyin Berberoglu. The plugin is out of date and it takes tons of modifications to get it going with an up to date Buddypress install.

The second method is a block of code placed in functions.php

function importSomething(){
return include_once 'bp-custom.php';
}
add_action( 'bp_setup_nav', 'buddyboss_child_bp_nav_adder' );
add_action( 'bp_template_content', 'profile_buddyboss_child_loop' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );

function buddyboss_child_bp_nav_adder() {
global $bp;
$post_count = count_user_posts_by_type( $bp->displayed_user->id );
bp_core_new_nav_item(
array(
'name' => sprintf( __( 'Posts <span>%d</span>', 'my-poems' ), $post_count ),
'slug' => 'Articles',
'position' => 250,
'show_for_displayed_user' => true,
'screen_function' => 'buddyboss_child_list',
'item_css_id' => 'articles',
'default_subnav_slug' => 'public'
));
}
function buddyboss_child_list() {
add_action( 'bp_template_content', 'profile_buddyboss_child_loop' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
/*------- This is end of the code for above function ---------*/
function profile_buddyboss_child_loop() {
$myposts = get_posts(  array(
'posts_per_page' => -1,
'author'         => bp_displayed_user_id(),
'post_type'      => 'post'
));
if( ! empty($myposts) ) { 
foreach($myposts as $post) {
setup_postdata( $post );
if (has_post_thumbnail( $post->ID ) ):
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'sidebar-smallthumbnew' );
else :

$image[0] = "http://www.example.com/wp-content/uploads/2015/10/userpost.jpg";
endif;

echo '<li class="sidebar mostpop post-' . $post->ID . '"><span id="postimage"><a href="' . get_permalink($post->ID) . '"><img src="' . $image[0] . '" /></a></span><div id="postinfo"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div></li>';
}
echo '</ul>';
wp_reset_postdata();
} else { ?>
<div class="info" id="message">
<p><strong><?php bp_displayed_user_fullname(); ?></strong> has No posts.</p>
</div>
<?php }
}
/* This is end of the code for above function */
remove_filter('bp_setup_nav','');
function count_user_posts_by_type( $userid, $post_type = 'post' ) {
global $wpdb;
$where = get_posts_by_author_sql( $post_type, true, $userid, true);
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
return apply_filters( 'get_usernumposts', $count, $userid );
}

This works fine but it's quite limited. It also messes with Buddypress updates rendering the two latest Buddypress updates useless (Star message, and Upload Background image).

Guys please get around to integrating this ability in Buddypress so one doesn't have to spend hours searching and trouble shooting for a function which I believe and others should be an already main component.

Attachments (1)

postinprofile.png (18.5 KB) - added by Dono12 4 years ago.
Screen shot of post in profile using the giving function

Download all attachments as: .zip

Change History (7)

@Dono12
4 years ago

Screen shot of post in profile using the giving function

#1 @boonebgorges
4 years ago

  • Component changed from Component - XProfile to Component - Members
  • Keywords reporter-feedback removed
  • Milestone changed from Awaiting Review to Under Consideration
  • Priority changed from omg pizza to normal
  • Severity changed from major to normal
  • Summary changed from Post On Buddypress Profile to Allow users to create WP posts on Buddypress Profile
  • Type changed from defect (bug) to enhancement

Hi Dono12 - Thanks for the ticket, and welcome to BuddyPress Trac.

I agree that many sites would find it useful for members to be able to create WP posts from their BP profiles. In the past, I've built this feature for clients.

Unfortunately, it's more complicated than just "getting around to implementing it". The desired implementation will be quite different on a per-site basis:

  • My guess is that the majority - 70%? 80%? 90%? - of BP installations will *not* want this functionality. On most BP sites I've seen, the ability to create posts is something that admins wolud want to give to a very small subset of their users.
  • For those sites that *do* want the functionality, they'll want some fine-grained control over permissions. It's likely that an administrator would want to limit who gets the ability to create posts. Some might want users to be able to write and save posts, but not publish them (Contributor status). Some might only a subset of their users to have the ability, which means we need some admin tools for the feature.
  • We'll need to build a fairly extensive interface - rich text editor, taxonomy metaboxes, etc - to make the interface full-featured enough for the majority of users who do want the functionality.

I'm happy to leave this ticket open for feedback from other contributors, but as you can see, it will take a significant amount of work to build the feature you've requested.

In the meantime, I recommend BuddyForms Members, which I think does pretty much what you're asking for: https://buddyforms.com/downloads/buddyforms-members/

#2 in reply to: ↑ description @crossifixio
4 years ago

Oh yeah. Been searching for the best approach to front-end buddypress posting with each users posts in their respective profiles.

I've quite literally have spent more time searching and trying things out than I ever though possible. I was quite surprised.

Of course blogging is not the focus of Buddypress, but "blogging" is not the same activity it was 5 years ago and we continually see a shift coming.

I very much agree with @Dono12 and will be doing everything I possibly can to come up with a great solution. I will be sure to revisit and post when / if I am able to get the time.

As @boonebgorges pointed out, it's not easy, but I do believe the percentage of people finding this of great value will increase. Especially a newer "audience" of company brands turning to this hybrid setup for a community engagement platform / area of their online efforts / website.

Everything points to this direction.

Plenty of signs and trends have been brewing this last year and show how companies, brands, and agencies are excited about building a "Community for their Brand" instead of primarily pulling people to their website, making a sale, then pushing them away to various social channels for the engagement. Social Media API's are making this much more feasible to flip it. Of course SM isn't going away, just adapting to trends / changes.

#3 @DJPaul
3 years ago

  • Milestone changed from Under Consideration to Awaiting Review

#4 @DJPaul
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

The current template pack is not going to be updated to support front-end posting to a blog. Boone's comments from 7 month ago are still valid. A feature template pack that we build could support front-end posting, especially in this REST API-powered world, but I think it is unlikely to be a core feature for the forseeable future.

#5 @Dono12
2 years ago

Hey @boonebgorges and @DJPaul,

Can you guys please remove the instance of the site name in this URL:

http://PLEASE CHANGE THIS NAME TO SITE-NAME/wp-content/uploads/2015/10/userpost.jpg.

At the time of this post I was a newbie and I didn't take into account Indexing by search engines.

#6 @boonebgorges
2 years ago

  • Description modified (diff)

Changed.

Note: See TracTickets for help on using tickets.