I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

sweet alerts help – Not Urgent

dashed-slug.net Forums General discussion sweet alerts help – Not Urgent

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5846
    alexg
    Keymaster

    Hello Megan,

    If you change the single quotes to double quotes, then you can use escaped characters. You should be able to use \n to do a line break. If you are interested, you can learn more about this here.

    Don’t forget to use the filter to replace the strings, so as not to have to apply your changes to the plugin on every update.

    with regards

    EDIT: This solution is not entirely correct. Please stand by and I will give you a full example of how to do this shortly.

    #5848
    megeanwasson
    Participant

    Hey Alex 🙂
    I tried with double quotes did not work, but definitely your link to the php explanation did help. This is what worked, was so simple I did not even think to try it before.

    if ( Dashed_Slug_Wallets::get_option( ‘wallets_confirm_withdraw_user_enabled’ ) ) {
    $translation_array[‘submit_wd’] = apply_filters(
    ‘wallets_ui_text_submit_wd’,
    __( ‘Successfully submitted a withdrawal request of:
    %1$s %2$s
    to %3$s
    Please check your e-mail for confirmation instructions.’, ‘wallets-front’ )

    );
    That worked like a charm 🙂

    #5849
    alexg
    Keymaster

    The problem with the above solution is that once you switch to double quotes, the sprintf placeholders get interpreted by PHP as inline variables, so the $ signs need to be escaped.

    The complete solution suffers from a mild case of LTS, and it is this:

    
    function filter_wallets_ui_text_submit_wd( $string ) {
    	return "Successfully submitted a withdrawal request of %1\$s %2\$s to %3\$s.\nPlease check your e-mail for confirmation instructions.";
    }
    
    add_filter( 'wallets_ui_text_submit_wd', 'filter_wallets_ui_text_submit_wd' );
    
    #5850
    alexg
    Keymaster

    Megan I saw your reply after I posted mine. Good job, but please see my earlier comment about using the filter to avoid problems on plugin updates.

    #5851
    megeanwasson
    Participant

    Yes Thank You I always use filters 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.