Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-30T23:25:48-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=16557 2011-12-30T23:25:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=59312#p59312 <![CDATA[Re: Coupon responses]]> Statistics: Posted by Jason Caldwell — December 30th, 2011, 11:25 pm


]]>
2011-12-30T22:35:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=59307#p59307 <![CDATA[Re: Coupon responses]]>
You are the man! I have it configured exactly the way I want now.

Thanks a million!

Jeffry

Statistics: Posted by jevans161 — December 30th, 2011, 10:35 pm


]]>
2011-12-30T22:22:14-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=59305#p59305 <![CDATA[Re: Coupon responses]]> ngettext_with_context

Create this directory and file:
/wp-content/mu-plugins/s2-n-contextual-translation.php
Code:
<?php
add_filter
('ngettext_with_context', 's2_n_contextual_translation', 10, 5);
function s2_n_contextual_translation($translated = NULL, $original_single = NULL, $original_plural = NULL, $number = NULL, $context = NULL)
    {
        if($context === 's2member-front' && $original_single === 'for %1$s %2$s')
            /* Ex: `good for 1 month`. Using `%1$s` and `%2$s`. */
            $translated = 'good for %1$s %2$s';
        /**/
        else if($context === 's2member-front' && $original_plural === 'for %1$s %3$s')
            /* Ex: `good for 2 months`. Using `%1$s` and `%3$s`. */
            $translated = 'good for %1$s %3$s';
        /**/
        return $translated;
    }
?>
s2-n-contextual-translation.zip

Statistics: Posted by Jason Caldwell — December 30th, 2011, 10:22 pm


]]>
2011-12-30T21:59:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=59301#p59301 <![CDATA[Re: Coupon responses]]> Statistics: Posted by jevans161 — December 30th, 2011, 9:59 pm


]]>
2011-12-30T21:30:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=59294#p59294 <![CDATA[Re: Coupon responses]]> Thanks for the follow-up Jeffry.
So sorry, there are actually two variations, one for plain text and another for HTML. I've updated to code sample above to account for all variations. See: viewtopic.php?f=4&t=16557&p=59282#p59282

Statistics: Posted by Jason Caldwell — December 30th, 2011, 9:30 pm


]]>
2011-12-30T21:06:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=59289#p59289 <![CDATA[Re: Coupon responses]]>
I tried this, and it didn't work. What am I doing wrong? I did not change the code in any way, and put it in the mu-plugins directory...

Thanks,

Jeffry

Statistics: Posted by jevans161 — December 30th, 2011, 9:06 pm


]]>
2011-12-30T20:35:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=59282#p59282 <![CDATA[Re: Coupon responses]]> Thanks for the heads up on this thread.

For anything like this that is NOT already implemented into s2Member's configurable interface, you can use contextual translation filters to modify the messages that s2Member displays.

All of s2Member's front-end messages are filterable using the gettext_with_context filter provided by the WordPress core.

Here is an example. Create this directory and file:
/wp-content/mu-plugins/s2-contextual-translation.php
( this is a MUST USE plugin, see: http://codex.wordpress.org/Must_Use_Plugins )
Code:
<?php
add_filter
("gettext_with_context", "s2_contextual_translation", 10, 3);
function s2_contextual_translation($translation = NULL, $original = NULL, $context = NULL)
    {
        if($context === "s2member-front" && $original === "COUPON %s off. ( Now: %s )")
            /* Here you provide the translation.
            You can take the `%s` Replacement Codes out if needed. */
            $translation = "You received %s off. ( You now pay: %s )";
        /**/
        else if($context === "s2member-front" && $original === '<div>Coupon: <strong>%s off</strong>. ( Now: <strong>%s</strong> )</div>')
            $translation = '<div>You received: <strong>%s off</strong>. ( You now pay: <strong>%s</strong> )</div>';
        /**/
        else if($context === "s2member-front" && $original === "COUPON %s off. ( Now: %s, then %s )")
            $translation = "You received %s off. ( Now pay: %s, then %s )";
        /**/
        else if($context === "s2member-front" && $original === '<div>Coupon: <strong>%s off</strong>. ( Now: <strong>%s, then %s</strong> )</div>')
            $translation = '<div>You received: <strong>%s off</strong>. ( Now pay: <strong>%s, then %s</strong> )</div>';
        /**/
        return $translation;
    }
?>
s2-contextual-translation.zip

Statistics: Posted by Jason Caldwell — December 30th, 2011, 8:35 pm


]]>
2011-12-27T21:23:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=58986#p58986 <![CDATA[Re: Coupon responses]]> Statistics: Posted by jevans161 — December 27th, 2011, 9:23 pm


]]>
2011-12-27T05:21:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=58896#p58896 <![CDATA[Re: Coupon responses]]> viewtopic.php?f=40&t=13268&src_doc_v=110710#src_doc_line_401 but I don't see a hook you can use to customize it... You'd have to edit the source file, but it'll get overwritten the next time you update the plugin. This still needs to be improved. :|

Statistics: Posted by Cristián Lávaque — December 27th, 2011, 5:21 am


]]>
2011-12-26T12:24:46-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16557&p=58836#p58836 <![CDATA[Coupon responses]]> Statistics: Posted by jevans161 — December 26th, 2011, 12:24 pm


]]>