Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 7 years ago

#6141 closed defect (bug) (fixed)

Post types activities are not set when using Ajax

Reported by: imath Owned by: boonebgorges
Milestone: 2.2 Priority: normal
Severity: normal Version:
Component: Activity Keywords: has-patch commit
Cc:

Description

To reproduce, put the following code in a bp-custom.php file :

add_post_type_support( 'page', 'buddypress-activity' );

Post a page, then find the corresponding activity in the database and remove the content or edit the action field.
Go to the activity directory, you should see "username wrote a new item" whatever you edited in the db action field.
If you filter the stream to list Pages, you'll have the content you edited (or nothing if you removed the action string) in the db action field.

Since activity action strings are generated at run time, the format callback should always be available even when doing Ajax.

So i suggest the attached patch to solve the issue.

Attachments (2)

6141.patch (579 bytes) - added by imath 7 years ago.
6141.2.patch (1.5 KB) - added by boonebgorges 7 years ago.

Download all attachments as: .zip

Change History (5)

@imath
7 years ago

#1 follow-up: @boonebgorges
7 years ago

Thanks, imath. 6141.patch seems pretty arbitrary. Since this problem has now come up twice (#6126), we should try to get to the bottom of it in a less arbitrary way.

See [6141.2.patch]. By using bp_activity_get_actions() here instead of touching the global directly, we ensure that every action type gets registered. If this works, we can roll back [9366].

@boonebgorges
7 years ago

#2 in reply to: ↑ 1 @imath
7 years ago

  • Keywords commit added

Replying to boonebgorges:

If this works, we can roll back [9366].

You're absolutely right. Tested many things with the patch and everything works fine, let's revert r9366 but i think we should keep the unit test DJPaul added in his commit.

#3 @boonebgorges
7 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 9382:

In bp_activity_generate_action_string(), use bp_activity_get_actions() rather than touching global directly.

This change ensures that the filters called by bp_activity_get_actions() are
run, which gives a chance for dynamically registered actions to register
themselves just in time whenever an activity string needs to be generated.

This change is a more general fix than the one introduced in [9366], so that
changeset (minus its unit tests) has been rolled back. See #6126.

Fixes #6141.

Note: See TracTickets for help on using tickets.