awesomemotive / one-click-demo-import

One Click Demo Import plugin
https://www.awesomemotive.com/
195 stars 83 forks source link

"That's it, all done!" Notice #176

Closed JakJakson closed 5 years ago

JakJakson commented 5 years ago

Hey guys,

Firstly thank you fo this amazing plugin!

Just a quick question - is there any way to modify the text on the "success notice":

"That's it, all done! The demo import has finished. Please check your page and make sure that everything has imported correctly. If it did, you can deactivate the One Click Demo Import plugin, because it has done its job."

Cheers! Jakson

all-done-notice
primozcigler commented 5 years ago

Hi @JakJakson and thanks!

As seen here at the moment that can only be changed by translating this string. But if you'd need that functionality you can submit a PR with an enhancement and I'll be happy to merge it.

JakJakson commented 5 years ago

Hey @primozcigler ! thanks for this - I used the translate string recommendation - worked like a charm - It was to point the user to update their permalinks. Here's the code I sued in case anyone else needs it:

`// Update the OCDI Success Notice

add_filter( 'gettext', 'translate_ocdi_strings', 999, 3 );

function translate_ocdi_strings( $translated, $text, $domain ) {

    $url = admin_url( '/options-permalink.php' ) ;
    $newtext= 'The demo import has finished. Please check your site and make sure that everything has imported correctly. If it did, you can deactivate the %3$sOne Click Demo Import%4$s plugin, because it has done its job.

    <br><br>
    You may need to <b>Save your Permalinks settings</b>  - use the link below to do that now.

    <br>
    <a class=".wp-core-ui .button-primary" href="' . $url . '">Save Permalinks <span class="dashicons dashicons-arrow-right-alt"></a> <br>';

// STRING 1 $translated = str_ireplace( 'The demo import has finished. Please check your page and make sure that everything has imported correctly. If it did, you can deactivate the %3$sOne Click Demo Import%4$s plugin, because it has done its job', $newtext, $translated );

/ // STRING 2 $translated = str_ireplace( 'Original Text', 'New Text', $translated ); /

// ETC.

return $translated; }`