Skip to content

Two duplicate *_get_user_artist_ids wrappers (api + shop) — both thin pass-throughs to canonical resolver #85

Description

@chubes4

Summary

Two byte-for-byte-equivalent "get a user's artist IDs" wrappers exist in two plugins, both delegating to the canonical ec_get_artists_for_user() with identical bodies:

  • extrachill_api_shop_get_user_artist_ids( $user_id = null )extrachill-api/inc/routes/shop/products.php:148
  • extrachill_shop_get_user_artist_ids( $user_id = null )extrachill-shop/inc/abilities/product-write-helpers.php:62

Both do exactly:

if ( ! $user_id ) { $user_id = get_current_user_id(); }
if ( ! function_exists( 'ec_get_artists_for_user' ) ) { return array(); }
return ec_get_artists_for_user( $user_id );

Why it's debt

Pure duplication of a trivial pass-through across a plugin boundary. Not a correctness bug — both already route through the canonical resolver — but a micro-instance of the platform's #1 anti-pattern: the same identity question wrapped separately per consumer instead of calling the one shared helper directly.

Open question

Since both are thin pass-throughs to ec_get_artists_for_user(), the simplest fix is to delete both wrappers and have the shop/api routes call ec_get_artists_for_user() directly (guarded by the existing function_exists check), rather than introduce a third shared wrapper. Confirm there are no callers relying on the wrapper name as an extension seam first.

Acceptance criteria

  • Call sites use ec_get_artists_for_user() directly (or one shared helper), not two per-plugin copies
  • No behavior change (still publish-filtered via the canonical resolver)

Found in the identity-core deep audit: extrachill-artist-platform#58 (§3, §5, [LOW]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions