Skip to content

Commit 172bbdb

Browse files
authored
Memberships: Created change-content-category-restriction-messages.php
1 parent 3decf6e commit 172bbdb

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php // only copy if necessary
2+
3+
/*
4+
* Edits the default content category restriction messages displayed to customers.
5+
*
6+
* @param array $messages containing default restriction messages
7+
* @return array $messages the updated array
8+
*/
9+
function sv_wc_memberships_default_messages( $messages ) {
10+
11+
/* Content Category Restriction messages
12+
*
13+
* Basic HTML is allowed. You can also use the following merge tags:
14+
* {products} automatically inserts the product(s) needed to gain access.
15+
* {date} inserts the date when the member will gain access to delayed content.
16+
* {discount} inserts the highest product discount obtainable by becoming a member.
17+
* {login_url} inserts the URL to the “My Account” page with the login form.
18+
* {login} inserts a login link to the “My Account” page with the login form.
19+
*/
20+
21+
// edits message displayed when the content is time-delayed so not available _yet_
22+
$messages['content_category_delayed_message'] = 'DESIRED_MESSAGE_GOES_HERE';
23+
24+
// edits message displayed when a category is restricted, but customers can purchase a product to get access
25+
$messages['content_category_restricted_message'] = 'DESIRED_MESSAGE_GOES_HERE';
26+
27+
// edits message displayed when category is restricted and no product is available to purchase access to view category
28+
$messages['content_category_restricted_message_no_products'] = 'DESIRED_MESSAGE_GOES_HERE';
29+
30+
// return the updated array
31+
return $messages;
32+
};
33+
34+
add_filter( 'wc_memberships_default_messages', 'sv_wc_memberships_default_messages', 10, 1 );

0 commit comments

Comments
 (0)