Simple Membership Plugin Change Logged In Information Text

Simple Membership Plugin Change Logged In Information Text

I recently helped a client with a new Elementor based website. He had already chosen a membership plugin but it didn’t work with Elementor because of JavaScript conflicts. I did some research, and in particular on the Elementor Facebook Group. The Simple Membership Plugin looked like the best choice for his purposes.

Once it was installed and setup, he didn’t like the text displayed on the Logged In User Page.

Simple Membership Plugin Before Change Logged In Information Text

In particular, he wanted the Account Expiry field to be “N/A” instead of “Never”. But that is not a configurable field. One way to make the change would be to create a US English Portable Object Template, aka POT file. But that, IMHO, is a complicated mess for a small changes. See How to Change Language Strings in WordPress. In general, if it is small change and the plugin is not updated frequently, I just change the text in the plugin code.

I checked the page for where the word “Never” comes from and found this code:

[php]
<?php echo $auth->get_expire_date(); ?>
[/php]

Then I searched the plugin code to find out where the result of the function get_expire_date() comes from. It is from this code in class.swpm-utils.php:

[php]
public static function get_formatted_expiry_date($start_date, $subscription_duration, $subscription_duration_type) {
if ($subscription_duration_type == SwpmMembershipLevel::FIXED_DATE) {
//Membership will expire after a fixed date.
return SwpmUtils::get_formatted_date_according_to_wp_settings($subscription_duration);
}

$expires = self::calculate_subscription_period_days($subscription_duration, $subscription_duration_type);
if ($expires == ‘noexpire’) {
//Membership is set to no expiry or until cancelled.
return SwpmUtils::_(‘Never’);
}
[/php]

I changed

[php]return SwpmUtils::_(‘Never’);[/php]

to

[php]return SwpmUtils::_(‘N/A’); [/php]

As I already noted, when the plugin is updated, this change may be overwritten, so I’ll have to make the change again so I document the change in an email to myself so I can easily find in copy it back in for a very small time charge.

Here’s a short video covering the changes.