Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 8 years ago

#3565 closed enhancement (worksforme)

Allow a group to post to activity stream as if it were a user

Reported by: modemlooper's profile modemlooper Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

I'm having trouble figuring out a way to have an activity stream update not be attached to a user. I need a group to be able to post to the stream as if it were a user. "the group xx posted an update..."

I am updating the external blog plugin and Andy originally had the update post as a false user but that breaks deleting since you no longer can delete unless the activity update is attached to a user_id.

But more so, I have ideas for group plugins if a group can post as a user. Think Facebook fan pages and you get the idea.

Change History (8)

#1 @boonebgorges
13 years ago

  • Milestone changed from Awaiting Review to 1.6

Can you point to the place where not having a user_id breaks deletion? Fixing that could be a short-term fix for the issue.

As for the larger request, I think we should tackle it along with the migration to custom post types. My own view is that we should do away with the confusing item_id and secondary_item_id schema, and instead adopt a number of taxonomies or metadata standards: activity_group, activity_user, activity_blog_id, activity_forum_post_id, etc. That way you'd be able to use core taxonomy functions to get exactly the posts you want. And, by extension, you'd be able to change the markup on the way out, so that they appear however you want: "modemlooper posted an update" or "the group 'modemlooper's posse' posted an update" or whatever, all from the same background data.

Ideas on further implementation are welcome.

#2 @modemlooper
13 years ago

Here's the code Andy had to save the activity. It originally was user_id => false. But that did not work to delete, however, the favorites and comments worked just not deleting.

I'm going to attach it to the groups creator id for now because it won't delete unless user_id is anything but 0.

		$admin_id = $group->creator_id;

		/* Record or update in activity streams. */
		groups_record_activity( array(
			'id' => $id,
			'user_id' => $admin_id,
			'action' => $activity_action,
			'content' => $activity_content,
			'primary_link' => $item['link'],
			'type' => 'exb',
			'item_id' => $group_id,
			'secondary_item_id' => wp_hash( $post['blogurl'] ),
			'recorded_time' => gmdate( "Y-m-d H:i:s", $post_date ),
			'hide_sitewide' => $hide_sitewide
		) );

got a dev version over at github https://github.com/modemlooper/buddypress-rss-feeds

Last edited 13 years ago by modemlooper (previous) (diff)

#3 @modemlooper
13 years ago

Whats odd is if I specify a number even if it's a number not associated with a user_id it will work just not if the number is 0.

#4 @boonebgorges
13 years ago

Have you looked into the activity component to see where the problem is taking place? That sounds like a bug.

#5 @modemlooper
13 years ago

If I make the user_id 22 and that user id doesn't exist it displays the default avatar and it works. If you make the number 0 no default avatar and delete button does not work. the main problem is I need the activity updates to post but not be attached to a user.

#6 @boonebgorges
13 years ago

Yeah, I get what you're trying to do, and I get that it doesn't work, but I was wondering if you'd opened up the bp-activity codebase to trace the problem to its source. I will try to take a look tomorrow if you don't beat me to it.

#7 @DJPaul
13 years ago

  • Milestone changed from 1.6 to Future Release

#8 @r-a-y
8 years ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Closing because I know there are at least a few plugins out there that record activity items with user_id = 0.

So this problem isn't valid any more.

Note: See TracTickets for help on using tickets.