Support

Home Forums Event Espresso Premium How to Change the Wording When a Class is Full or Closed

How to Change the Wording When a Class is Full or Closed

Posted: March 20, 2014 at 12:25 pm

Viewing 22 reply threads


John Fineberg

March 20, 2014 at 12:25 pm

I’m trying to change the wording of the message that registrants get when a class is full or closed. I know I’ve changed the wording before, but I can’t remember how to access the area to make changes now. Can you tell me how to get there again?

Here’s what I have now:

http://www.cpr-twincities.com/register?ee=236


Lorenzo Orlando Caum

  • Support Staff

March 20, 2014 at 2:15 pm

Hi John,

This can be done. Which sentences do you want to change and what should they be changed to?


Lorenzo


John Fineberg

March 20, 2014 at 2:27 pm

Thanks, Lorenzo. I want to change this:

“We are sorry but registration for this event is now closed. Please contact us if you would like to know if spaces are still available.”

I don’t have the wording worked out yet. I just need to know how to get to that text, so I can change it anytime I want.

~ John


Lorenzo Orlando Caum

  • Support Staff

March 20, 2014 at 2:48 pm

Sure, no problem. Try these in your functions.php or a custom plugin:

function closed_registration_message_one($phrase) {
        $phrase = str_replace('We are sorry but registration for this event is now closed.', 'ReplaceMe', $phrase);
        return $phrase;
}
add_filter('the_content', 'closed_registration_message_one', 175);
function closed_registration_message_two($phrase) {
        $phrase = str_replace('Please contact us if you would like to know if spaces are still available.', 'ReplaceMe', $phrase);
        return $phrase;
}
add_filter('the_content', 'closed_registration_message_two', 200);

It works by looking for the exact phrase and then replacing it with something else. In the examples above, they would both become:

ReplaceMe


Lorenzo


Tony

  • Support Staff

March 20, 2014 at 3:52 pm

I think its worth noting this can also be done by ‘Translating’ those phrases.

Those two strings are translatable and can be altered using the Language files and POEdit, a translation plugin or a custom function. We have a guide posted on how to do this available here:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/

The two strings are

‘We are sorry but registration for this event is now closed.’
&
‘Please contact us if you would like to know if spaces are still available.’

If using a translation plugin these can be altered from within the WP Dashboard.

The method Lorenzo posted will also work, this is just another option.


John Fineberg

March 21, 2014 at 7:57 am

Thank you Lorenzo and Tony. As a first step, I tried adding this to “My Custom CSS” (without bothering to change the wording, just as an experiment):

function closed_registration_message_one($phrase) {
$phrase = str_replace(‘We are sorry but registration for this event is now closed.’, ‘ReplaceMe’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_one’, 175);
function closed_registration_message_one($phrase) {
$phrase = str_replace(‘Please contact us if you would like to know if spaces are still available.’, ‘ReplaceMe’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_two’, 200);

I expected to see “ReplaceMe” where the other wording had been. But it did nothing. Will it not work by using that plugin? And is there a difference between the functions of My Custom CSS and POEdit?


Lorenzo Orlando Caum

  • Support Staff

March 21, 2014 at 9:37 am

Hi John,

My Custom CSS handles CSS (styling) only.

Could you try relocating that sample code to your theme’s functions.php file?


Lorenzo


John Fineberg

March 21, 2014 at 3:35 pm

If it’s not in My Custom CSS, then maybe I was mistaken about having changed the verbiage earlier. Could you provide me with exact steps to find where to paste your code? In case it matters, my site is posted through Bluehost.


Lorenzo Orlando Caum

  • Support Staff

March 21, 2014 at 3:48 pm

There are two options.

This can go into a custom WP plugin (http://justintadlock.com/archives/2011/02/02/creating-a-custom-functions-plugin-for-end-users)

Alternatively, you can add it to your theme’s functions.php file.

This will be in this location:

wp-content/themes/YourThemeFolder/functions.php

You can use a free SFTP or FTP client such as filezilla or cyberduck to add the code to the functions.php file.

The credentials for SFTP or FTP will available from your webhost.


Lorenzo


John Fineberg

March 23, 2014 at 1:11 pm

I’ve followed the instructions of creating and activating a “My Custom Functions” plugin. I’m pretty sure that went okay. I then dropped in your code between the lines, as instructed, with my changes (though I have no idea where my changes were supposed to be placed):

<?php
/**
* Plugin Name: My Custom Functions
* Plugin URI: http://yoursite.com
* Description: This is an awesome custom plugin with functionality that I’d like to keep when switching things.
* Author: Your Name
* Author URI: http://yoursite.com
* Version: 0.1.0
*/

/* Place custom code below this line. */
function closed_registration_message_one($phrase) {
$phrase = str_replace(‘We are sorry but registration for this event is now closed.’, ‘ReplaceMe’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_one’, 175);
function closed_registration_message_one($phrase) {
$phrase = str_replace(‘Please contact us if you would like to know if spaces are still available.’, ‘Please contact us if you would like to be placed on a waiting list.’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_two’, 200);
/* Place custom code above this line. */
?>

And here is the resulting error message I received:

This plugin has been deactivated because your changes resulted in a fatal error.

Parse error: syntax error, unexpected ‘are’ (T_STRING) in /home6/cprtwinc/public_html/wp-content/plugins/my-custom-functions.php on line 13

So what’s going wrong to cause a “fatal error?” And where do my edits belong? I want it to say:

This class is now full. Please sign up for a different date. Or, if you would rather be on a waiting list for this class, please contact us.

And I’d like the “contact us” to still be a link, as it currently is.


Lorenzo Orlando Caum

  • Support Staff

March 23, 2014 at 1:31 pm

It was the type of commas. This file is ready to go:

http://cl.ly/code/001C0H3F1E0j

I also corrected an error in my prior post. The second function should have a different name from the first (one –> two).

Go ahead and upload to wp-content/plugins. Then activate to see how it works.

Then you can make edits as needed to the messaging.


Lorenzo


John Fineberg

March 23, 2014 at 1:52 pm

I copied and pasted the above link code and activated the plugin. Should I now see the plugin listed in the WP menu?

It’s not clear to me if I’m supposed to make any changes (one->two) somewhere or if you’ve already done it in the code.


John Fineberg

March 23, 2014 at 2:00 pm

Isn’t there a more direct route to making the changes I want? Something like wp-content->plugins->event-espresso->??? If I could just find the words, I could change the words to suit my needs. Too bad it’s all hidden so deep.


Lorenzo Orlando Caum

  • Support Staff

March 23, 2014 at 6:11 pm

Hi John,

This is not something that you can change through the WordPress admin.

There are two solutions:

The first is here: https://eventespresso.com/topic/how-to-change-the-wording-when-a-class-is-full-or-closed/#post-87524 (which you have currently setup through a custom plugin)

The purpose of the custom plugin is to protect your changes from software updates. The plugin that I shared is looking for a specific phrase and will replace it with one that you specify.

If you view the first function, you’ll see that it is looking for “We are sorry but registration for this event is now closed.” It will then replace the phrase with “ReplaceMe”

You’ll need to edit ReplaceMe in the plugin to your phrase.

Tony shared another solution here: https://eventespresso.com/topic/how-to-change-the-wording-when-a-class-is-full-or-closed/#post-87551 (in this solution you edit a language file)


Lorenzo


John Fineberg

March 24, 2014 at 10:19 am

Here’s what I’ve placed in My Custom Functions:

function closed_registration_message_one($phrase) {
$phrase = str_replace(‘We are sorry but registration for this event is now closed.’, ‘We’re sorry, but this class is full.’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_one’, ‘175’);

function closed_registration_message_two($phrase) {
$phrase = str_replace(‘Please contact us if you would like to know if spaces are still available.’, ‘Please contact us if you would like to be placed on a waiting list.’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_two’, ‘200’);

At first, this worked in changing the first of the two sentences. Then, when I went back to try again, for some reason, there was another “fatal error,” and it reverted back to the original working on the webpage. If I am misinterpreting your instructions, please make the corrections and send them back to me.

And back to my other question, shouldn’t My Custom Functions be showing up in the WP menu (just like My Custom CSS does)?


Lorenzo Orlando Caum

  • Support Staff

March 24, 2014 at 10:52 am

What is the current code that is causing the fatal?

This is a plugin with a name of My Custom Function. It does not have any capabilities for the WordPress admin.


Lorenzo


John Fineberg

March 24, 2014 at 11:00 am

<?php
/**
* Plugin Name: My Custom Functions
* Plugin URI: http://yoursite.com
* Description: This is an awesome custom plugin with functionality that I’d like to keep when switching things.
* Author: Your Name
* Author URI: http://yoursite.com
* Version: 0.1.0
*/

function closed_registration_message_one($phrase) {
$phrase = str_replace(‘We are sorry but registration for this event is now closed.’, ‘We’re sorry, but this class is full.’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_one’, ‘175’);

function closed_registration_message_two($phrase) {
$phrase = str_replace(‘Please contact us if you would like to know if spaces are still available.’, ‘Please contact us if you would like to be placed on a waiting list.’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_two’, ‘200’);

?>


Lorenzo Orlando Caum

  • Support Staff

March 24, 2014 at 11:12 am

Try this file:

http://cl.ly/code/2e0h2v0A2h0g

I’ve added your new messaging to it.


Lorenzo


John Fineberg

March 24, 2014 at 11:42 am

That fixes the first line, but not the second:

We are sorry, but the class is full.

Please contact us if you would like to know if spaces are still available.


Dean

March 25, 2014 at 1:20 am

Hi,

The “Please contact us…” text string is actually 3 different ones.

If you change the line to read

$phrase = str_replace('if you would like to know if spaces are still available.', 'if you would like to be placed on a waiting list.', $phrase);

that should resolve it for you.


John Fineberg

March 25, 2014 at 7:56 am

Hi, Dean. Thanks for your help. I tried making that replacement, but it didn’t change anything. So I tried again, thinking that maybe I should change “two” to “three,” but that didn’t help. Then I thought that the line number, 200, was for the second of the three you mentioned, but I have no idea what number that ought to be.

So, here’s what I want it to say:

We’re sorry, but this class is now full. Please contact us if you would like to be placed on a waiting list.

Can you make changes to the following code and send it back to me, with whatever changes need to be made, then I assume it should work flawlessly:

function closed_registration_message_one($phrase) {
$phrase = str_replace(‘We are sorry but registration for this event is now closed.’, ‘We are sorry, but this class is already full.’, $phrase);
return $phrase;
}
add_filter(‘the_content’, ‘closed_registration_message_one’, ‘175’);

function closed_registration_message_two($phrase) {
$phrase = str_replace(‘Please contact us if you would like to know if spaces are still available.’, ‘Please contact us if you would like to be placed on a waiting list.’, $phrase);
add_filter(‘the_content’, ‘closed_registration_message_two’, ‘200’);

By the way, Dean, I think it’s curious that the previous people involved in this forum have not mentioned that you have a waiting list option in Event Espresso. I discovered it on my own yesterday on your website: https://eventespresso.com/wiki/create-a-waiting-list-for-your-event/


John Fineberg

March 26, 2014 at 12:34 pm

It doesn’t look like your automated waiting list option is going to work for us, but I still want potential students to contact us once registration is closed. So please send me the complete code to make it say:

We’re sorry, but this class is now full. Please contact us if you would like to be placed on a waiting list.


Dean

March 27, 2014 at 3:05 am

<?php
    /**
     * Plugin Name: My Custom Functions
     * Plugin URI: http://yoursite.com
     * Description: This is an awesome custom plugin with functionality that I'd like to keep when switching things.
     * Author: Your Name
     * Author URI: http://yoursite.com
     * Version: 0.1.0
     */
    
    
function closed_registration_message_one($phrase) {

	$phrase = str_replace('We are sorry but registration for this event is now closed.', 'We are sorry, but the class is full.', $phrase);

	return $phrase;

}
add_filter('the_content', 'closed_registration_message_one', '175');



function closed_registration_message_two($phrase) {

	$phrase = str_replace('if you would like to know if spaces are still available.', 'if you would like to be placed on a waiting list.', $phrase);

	return $phrase;

}
add_filter('the_content', 'closed_registration_message_two', '200');

function closed_registration_message_three($phrase) {

	$phrase = str_replace('We are sorry but this event has reached the maximum number of attendees!', 'We are sorry, but the class is full.', $phrase);

	return $phrase;

}
add_filter('the_content', 'closed_registration_message_three', '175');


John Fineberg

March 27, 2014 at 7:52 am

That worked! Thank you, once again, Dean.

Viewing 22 reply threads

The support post ‘How to Change the Wording When a Class is Full or Closed’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso