WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#7085 closed enhancement (fixed)

MagpieRSS user-agent filter

Reported by: JohnLamansky Owned by: westi
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch RSS Magpie
Focuses: Cc:

Description

Being able to customize the MagpieRSS user-agent would be useful for large WordPress sites (e.g. BuddyPress-powered social networks) who would want to identify themselves by their own site name instead of as "WordPress".

Attachments (3)

rss.php.diff (487 bytes) - added by JohnLamansky 6 years ago.
This patch would define the MAGPIE_USER_AGENT constant only if it hasn't already been defined. The constant could be defined through a manually-added constant definition in index.php, for example, or (preferably) via a plugin by hooking into the load_feed_engine action.
rss.php-2.diff (458 bytes) - added by JohnLamansky 6 years ago.
An alternate method, passing the user-agent through a filter instead of requiring a constant definition
rss.php-3.diff (547 bytes) - added by JohnLamansky 6 years ago.
A much better method

Download all attachments as: .zip

Change History (12)

JohnLamansky6 years ago

This patch would define the MAGPIE_USER_AGENT constant only if it hasn't already been defined. The constant could be defined through a manually-added constant definition in index.php, for example, or (preferably) via a plugin by hooking into the load_feed_engine action.

JohnLamansky6 years ago

An alternate method, passing the user-agent through a filter instead of requiring a constant definition

comment:1 JohnLamansky6 years ago

  • Keywords has-patch added

I've attached two different ways of doing this; I'll leave it up to the head developers to decide which one's better.

comment:2 DD326 years ago

Would be better to just consolidate all the external access functions so that the user agent for all requests can be managed.. (#4779)

comment:3 follow-up: JohnLamansky6 years ago

Even if Magpie used a remote_http() function like you mention, one would have to manually change the rss.php code to add the desired user-agent as a parameter for all remote_http() calls. Therefore, a magpie_user_agent filter would be appropriate regardless of whether or not ticket 4479 is implemented.

comment:4 in reply to: ↑ 3 DD326 years ago

Replying to JohnLamansky:

Even if Magpie used a remote_http() function like you mention, one would have to manually change the rss.php code to add the desired user-agent as a parameter for all remote_http() calls.

At the time, I was thinking of the Plugin adding itself to the User agent via a filter in the function for all requests. Not too sure how that'd work in retrospect though.

JohnLamansky6 years ago

A much better method

comment:5 JohnLamansky6 years ago

  • Summary changed from Allow customization of RSS user-agent to MagpieRSS user-agent filter

Ignore the first two attachments; I think rss.php-3.diff offers the most flexibility.

comment:6 ryan6 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

comment:7 JohnLamansky6 years ago

  • Milestone changed from 2.9 to 2.6.1

comment:8 westi6 years ago

  • Milestone changed from 2.6.1 to 2.7
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

comment:9 westi6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [8503]) Allow a plugin to change the filter the magpie user agent string. Fixes #7085 props JohnLamansky.

Note: See TracTickets for help on using tickets.