Support

Home Forums WP User Integration Where can I find this page to edit the text please?!

Where can I find this page to edit the text please?!

Posted: June 19, 2013 at 6:32 am


miranda rota

June 19, 2013 at 6:32 am

When people are not logged in and/or registered …and they have clicked on the Forthcoming Events widget in the side bar, they are taken to a page  – how can I find that page to edit the text?

http://bridale-architectural-antiques.co.uk/yep_3/forthcoming-events/?ee=5

This is what the page says:
You are not logged in.
Before you can reserve a spot, you must register.
If you are a returning user please Login
New users please Register


miranda rota

June 19, 2013 at 6:39 am

Sorry, also forgot to ask how to edit the text on the actual events info as well, where on the bottom of the event info it says:  ‘Member Only Event’


Dean

June 19, 2013 at 6:42 am

Hi,

That is an event, you can tell that by the ee=5 at the end of the URL.

If you head over to Event Overview, the ID column on the left will correspond with the event, so find ID 5 and thats the event in question.

It is set to Member Only so you would have to be logged in to view it.

Ahhh just re-read you post, sorry. To change the text you will need to translate the plugin, sounds weird but there is a guide for it and it is quite easy.


miranda rota

June 19, 2013 at 9:49 am

Dean, thank you but I have done everything you say above, have read everything in the other links that I can find but cannot bring the .po file into Poedit.  I downloaded the uk .po file which I downloaded from the page given, then right click on it and say: open with Poedit but Poedit just opens with a totally blank sections everywhere.

I ‘ve also tried opening Poedit and then clicking in there to open the event esspresso .po file – always it looks as though it’s going to work, but always nothing whatsoever appears in Poedit boxes …anywhere!!

I could not find any tutorial saying how to use Poedit either.  Please, can you tell me the magical thing that will open the EE .po in Poedit?!!


Josh

  • Support Staff

June 19, 2013 at 10:18 am

Hi Miranda,

It doesn’t sound like the file was downloaded, it might be the web page instead of the .po file. Can you try right-clicking then save as?

I can also suggest an alternative way to change the text strings by using the WordPress gettext filter. There’s some example code here that you can copy and paste into the Custom file add-on’s custom-functions.php file and modify lines 6 and 7 (and add your own lines too) to change the text strings you want changed:

https://gist.github.com/joshfeck/4962940


miranda rota

June 20, 2013 at 8:22 am

Many thanks, Josh.  I did right click and save, to several of the EE .po files (germany, spain, etc.)  they are all quite big files (2.88mbs, etc.) but still nothing will arrive into Poedit interface – I even got my daughter to install on her computer and try but she got exactly same results as me.  Is a mystery for the time being!

Josh, I’ve just tried to do what you recommend.  I included a link to the registration page, and even included some link text in brackets.  It doesn’t like it as the site broke saying:
<blockquote cite=”Parse error: syntax error, unexpected T_STRING, expecting ‘)’ in /home/miranda8/public_html/yep_3/wp-content/themes/thesis_184/custom/custom_functions.php on line 44“>

I removed the brackets and uploaded using filezilla, but still the site is broken.  This is what I have put:
<blockquote cite=”

function mycustom_filter_gettext( $translated, $original, $domain ) {

 

// This is an array of original strings

// and what they should be replaced with

$strings = array(

/* ‘Register’ => ‘Sign up’, */

/* ‘Confirm and go to payment page’ => ‘Complete registration’, */

 

‘Member Only Event’ => ‘This is a Member Only Event.  Please login or, if you have not yet registered with this website, please do that <a href=”http://bridale-architectural-antiques.co.uk/yep_3/membership/” target=”_blank”>here (it’s free to join) </a>’

 

 

// Add some more strings here

);

 

// See if the current string is in the $strings array

// If so, replace it’s translation

if ( isset( $strings[$original] ) ) {

// This accomplishes the same thing as __()

// but without running it through the filter again

$translations = &get_translations_for_domain( $domain );

$translated = $translations->translate( $strings[$original] );

}

 

return $translated;

}

 

add_filter( ‘gettext’, ‘mycustom_filter_gettext’, 10, 3 );

“>

I would be really grateful if you can see what I’ve still got wrong there.

Many thanks for your time, it’s much appreciated 🙂

 


miranda rota

June 20, 2013 at 8:23 am

…also, can you tell me how to put code into blockquotes, I obviously got it wrong!


Josh

  • Support Staff

June 20, 2013 at 9:38 am

Hi Miranda,

I can’t say for sure since I don’t know what exactly is on line 44, but it’s probably the link text. In this case it will not work to add HTML code into the text string.

For now you could try editing the function directly in the espresso-members plugin in member_functions.php starting on line 145. I’ll make a note to add a hook here so in future versions this can be customized without editing the file itself.


miranda rota

June 20, 2013 at 1:33 pm

Josh, I’ve read through this many times and can’t see anything wrong with it (though I am not very expert at coding) but it keeps giving me other but similar error messages so something definitely is wrong somewhere.  (Please can you also tell me how to put this code into quotes if the one I’m using now does not work – which tag I should use?)

This is what I’ve put:

___________

<q cite=”/* –My Editing– */

 

/* This is for changing event esspresso text such as:  Members only event */

 

 

 

function mycustom_filter_gettext( $translated, $original, $domain ) {

 

 

 

    // This is an array of original strings

 

    // and what they should be replaced with

 

    $strings = array(

 

    /* ‘Register’ => ‘Sign up’, */

 

     /* ‘Confirm and go to payment page’ => ‘Complete registration’, */

 

 

 

         ‘Member Only Event’ => ‘This is a Member Only Event.  To register for the event please login or, if you have not registered with YEP London yet, please do that first via the menu bar above.  It is free to join YEP.’, 

 

 

 

 

        // Add some more strings here

 

    );

 

 

 

    // See if the current string is in the $strings array

 

    // If so, replace it’s translation

 

    if ( isset( $strings[$original] ) ) {

 

        // This accomplishes the same thing as __()

 

        // but without running it through the filter again

 

        $translations = &get_translations_for_domain( $domain );

 

        $translated = $translations->translate( $strings[$original] );

 

    }

 

 

 

    return $translated;

 

}

 

 

 

add_filter( ‘gettext’, ‘mycustom_filter_gettext’, 10, 3 );”>

Many thanks for your help.


Josh

  • Support Staff

June 20, 2013 at 1:49 pm

Hi Miranda,

You can copy the code into a service like Pastebin or a github gist and post a link to where we can see it in this thread.

We can investigate it from there if we have a good representation of the code you’re trying to use.


miranda rota

June 20, 2013 at 2:09 pm

Josh, will go and find those sites and do that then.
Just as an update though, I noticed a couple of posts above that you said to put the code into member-functions.php rather than custom-functions.php, which up till now I had been putting the code in.  Doing it in member-functions.php did not break the site but neither has it made the changes I’m attempting to make!  (I put the code in directly under   //Dynamic form fields  ….my version of Notepad++ is a bit weird as it is spacing out the lines about double spacing, including on every line CR’s and LF’s but I just doubled the line number you gave me so hope that line was the right place to put the code?)

Just want to confirm which file I should be putting the code in?


Josh

  • Support Staff

June 20, 2013 at 2:27 pm

It depends on what you want to do. The gettext filter function that you posted above should go into the custom files add-on.

If you go the route where you edit the text in the actual file, (no new funcitons), you’d edit the actual file.


miranda rota

June 20, 2013 at 2:51 pm

Josh, I’m probably stretching your patience here ….but I just want to get the default EE text edited – I don’t mind which way I do it (as long as it doesn’t involve Poedit, because it’s not working on my computer).

Could you be an angel and just tell me one way, the simplest way would be best, saying the full name of which file I need to put your gist code in (and which folder that file is in) and which line to start putting it, giving me the actual line of code just above where I should put it so I can identify the position correctly.

Many thanks for your patience.


miranda rota

June 20, 2013 at 3:24 pm

This is the code, I’m posting it in addition to my comment just above …please see my comment above as well!

http://pastebin.com/yEStsLpb


Josh

  • Support Staff

June 20, 2013 at 3:38 pm

Hi Miranda,

It looks like what you have in the pastebin will work, but you need to make one small change. If you look on line 50 where it says (it’s free to join), the apostrophe needs to be escaped because PHP will interpret it as a single quote and crash the site. You can escape it with a slash, so it will look like this:

(it\’s free to join)


miranda rota

June 21, 2013 at 12:03 pm

Josh, I’ve done it at last but the old maxim was never truer “You don’t know what you don’t know until you know it”.  I was putting that code in custom-functions file of the THEME I’m using – because that was the only custom-function file I knew about …doh! 🙁 (not surprising it broke the site)

Anyway, after much trial and tribulation for both of us, it’s done and it works, and it even has included the link.  (if anyone else ever needs this info, it was the ‘member-functions.php’ that is in the plugin: ‘espresso-members’ (one of the event espresso add-ons).

Many thanks Josh, really appreciate your patience 🙂


Josh

  • Support Staff

June 21, 2013 at 1:07 pm

It should work just fine to add the code to the custom functions file of the theme.

The support post ‘Where can I find this page to edit the text please?!’ 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