Skip to:
Content

BuddyPress.org

Opened 12 months ago

Closed 5 months ago

Last modified 5 months ago

#9286 closed enhancement (fixed)

bp_get_blog_latest_post not applying filters properly

Reported by: shawfactor's profile shawfactor Owned by: espellcaste's profile espellcaste
Milestone: 14.5.0 Priority: normal
Severity: normal Version:
Component: Blogs Keywords: has-patch reporter-feedback needs-testing
Cc: emaralive, pratiklondhe, rollybueno

Description

The function

bp_get_blog_latest_post does this on line 763

apply_filters( 'the_title', $retval )

However if you look at the documentation of that filter:

https://developer.wordpress.org/reference/hooks/the_title/

You will see that the there are two parameters $post_title and $post_id and both are mandatory, so that any plugin that adds this filter and follows the documentation strictly will cause a fatal error

Can this be fixed asap please?

Change History (10)

#1 @emaralive
12 months ago

  • Cc emaralive added

#2 @pratiklondhe
12 months ago

  • Cc pratiklondhe added

This ticket was mentioned in PR #411 on buddypress/buddypress by @rollybueno.


12 months ago
#3

  • Keywords has-patch added

Reported on https://buddypress.trac.wordpress.org/ticket/9286, the bp_get_blog_latest_post() will be using the_title filters but only provided 1 out of 2 required params

The patch includes creating new function called bp_get_blog_latest_post_id() which is just a copy of bp_get_blog_latest_post_title(), except it will return latest post ID instead of title.

Then we use this for the required param on the_title filters as per documentation: https://developer.wordpress.org/reference/hooks/the_title/

Ticket: https://buddypress.trac.wordpress.org/ticket/9286

Filter docs: https://developer.wordpress.org/reference/hooks/the_title/

Trac ticket: https://buddypress.trac.wordpress.org/ticket/9286

#4 @rollybueno
12 months ago

  • Cc rollybueno added
  • Keywords reporter-feedback needs-testing added

This ticket was mentioned in Slack in #buddypress by rollybueno. View the logs.


12 months ago

#6 @espellcaste
5 months ago

  • Component changed from Core to Blogs
  • Milestone changed from Awaiting Review to 14.5.0
  • Type changed from defect (bug) to enhancement

#7 @espellcaste
5 months ago

In 14164:

bp_get_blog_latest_post() make use of the the_title filter hook but only one param is provided.

We are introducing two new getters for the latest post ID. bp_get_blog_latest_post_id and bp_blog_latest_post_id.

Developed in https://github.com/buddypress/buddypress/pull/411

Props shawfactor, rollybueno, and dcavins.

See #9286 (14.0).

#8 @espellcaste
5 months ago

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

In 14165:

bp_get_blog_latest_post() make use of the the_title filter hook but only one param is provided.

We are introducing two new getters for the latest post ID. bp_get_blog_latest_post_id and bp_blog_latest_post_id.

Props shawfactor, rollybueno, and dcavins.

Closes https://github.com/buddypress/buddypress/pull/411
Fixes #9286 (trunk)

#9 @espellcaste
5 months ago

In 14185:

Address a WPCS error for the new bp_get_blog_latest_post_id function.

Introduced at [14165].

See #9286, #9174, and #9173.

#10 @espellcaste
5 months ago

In 14193:

Address a WPCS error for the new bp_get_blog_latest_post_id function.

Introduced at [14165].

See #9286#9174, and #9173 (14.0).

Note: See TracTickets for help on using tickets.