benecaster_get_signup_url()
benecaster_get_signup_url( int $show_id, int $user_id = 0 ): string
Returns where a show’s subscribe page lives: the answer to the benecaster_signup_url filter, or the show’s own page, where [benecaster_subscribe] normally sits.
This is the one place the filter is applied. benecaster_qr_code type=“signup” and the account page’s link for a free member to take out a paid plan both ask through it, so a link your add-on builds from it goes to the same page theirs do. Call this rather than applying the filter yourself.
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
show_id |
int |
— | Yes | WordPress post ID of the show. |
user_id |
int |
0 |
No | The member the link is for, or 0 for no particular member. 0 is not replaced by the current user. |
Return Value
Type:
string
The URL of the show's subscribe page, unescaped: escape it with esc_url() for output. The show's own page when the filter gives no usable answer. An empty string only when the show has no permalink (an ID that is not a show, or a show in the trash) or the ID is not positive.
Example
$url = benecaster_get_signup_url( $show_id, get_current_user_id() );
if ( $url ) {
printf(
'<a class="button" href="%s">%s</a>',
esc_url( $url ),
esc_html__( 'See the plans', 'my-addon' )
);
}
Hooks Fired
Notes
$user_id of 0 means no particular member, and it is not filled in with the current user: a link on a public page, or a printed QR code, has no member behind it. Pass the member's ID when the link is for one, so a filter callback can send them somewhere of their own.
It never returns a link to nowhere. An empty or unusable filter answer falls back to the show's page.
Need this built rather than just documented? See our services →