Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Goran87

    (@goran87)

    Hi marcjanik, in class-gens-raf-public.php, with a bit of php knowledget, there is generate_coupons method which you can work on to lower number of letters coupon can have.

    Plugin Author Goran87

    (@goran87)

    Marking resolved as i havent heard back, reply if you still need help.

    Best,
    Goran

    Within public function generate_coupons( $user_id ), on its 3rd line shows $coupon_code = substr( "abcdefghijklmnopqrstuvwxyz123456789", mt_rand(0, 50) , 1) .substr( md5( time() ), 1); // Code

    Why is it mt_rand(0, 50) instead of mt_rand(0, 34) since there are only 35 characters in the string of the first portion?

    • substr( "abcdefghijklmnopqrstuvwxyz123456789", mt_rand(0, 50) , 1) returns only 1 character
    • substr( md5( time() ), 1) returns the last 31 out of 32 characters.

    I’ll change the second portion to substr( md5( time() ), mt_rand(0, 31), 9) ), which will randomly pick the start of the 32 characters, and extract the next 9 characters from that point. At least, this will shorten the overall code length to 10 characters.

    By the way, is there any way not to hack into your plugin? Perhaps a hook will be better.

    Plugin Author Goran87

    (@goran87)

    Hey Jason,

    ill see to add hooks in the next version on couple of functions that should be changed by devs.

    You are correct for the above, it was probably copied from some of mine code snippets, will correct it in some update

    I look forward to your next release, Goran. Thank you.

    Thread Starter marcjanik

    (@marcjanik)

    I managed to get 10 character coupons as well (by editing file that you mentioned). And I’m also looking forward for an update or even you creating paid plugin with more options!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Coupon length?’ is closed to new replies.