Support » Plugin: Easy Invitation Codes » Sending invitation codes?

  • Resolved orboan


    I’d like to know if this plugin supports any way to send the invitation codes to future registered users. As the users are still not registered and we don’t have their email addresses, one way coul be a link on the site (frontend) saying “Request an Invitation” which leads the user to a form where he/she submits his/her email address, where the code is sent to (in the mail body there’ll be the code and a link to a registration form where to submit the code and additional fields).

    Well, I think I’ll have to code this process. Any hints on how to use this plugin to achieve the flow I explained?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Julio Potier


    You already have an option to add a link on front-end, then you can use the “create_invitation_code()” function to create a code (you have to pass it in parameter).

    Hello again Julio,

    ok, then I create a link on the front-end that sends the user to a simple form to put the email address. When actions triggered when clicking the Submit button of the form would be:

    1- trigger the php function create_invitation_code(), which I understand returns the code as a return value
    2- Pass the returned code as a parameter to a function that sends the email.

    Am I correct? Could you tell me what is the php funtion in WOrdpress to send the mail?

    Thanks for your support!

    Plugin Author Julio Potier


    1- You have to pass the wanted code in parameter like this :

    $code = substr( md5( time() . uniqid() ), 0, 5 );
    if( create_invitation_code( $code ) ):
      $msg = "Hello this is you code: $code";
      $to_user = 'foo@bar.baz';
      wp_mail( $to_user, $msg ); // This mail came "from" your "admin email"

    2- See above 😉

    Thx Julio,
    I’ll try as you say. In case I introduce some modifications to your plugin I’ll share it with you and the community.

    Plugin Author Julio Potier


    Good news 🙂

    Hi there, I cant get this to work. In fact, the create_invitation_code() does not work at all.

    I think its cause I dont include the header or footer and because of that the scripts arent included? I just copied the function from the back-end file into my template.

    $code = substr( md5( time() . uniqid() ), 0, 5 );
    Doesn’t the plugin uses wp_generate_password?
    Thanks to this simple function, I was able to create a template tag [INVITATION-CODE] in my emailing plugin using just 4 lines of code. Thanks again, author 🙂

    Plugin Author Julio Potier


    @zanotik : Because wp_generate_password is pluggable and i do not want that this codes can be hacked. So i use my own simple hash.
    Thanks to you for unsing my plugin, do not hesitate to rate it 😉

    Hmm… Not sure I understand what you mean, but isn’t this your code?


    function baweic_fields_cb2($val){

    $temp = strtoupper($prefix . wp_generate_password($length, false));

    I wanna display drop down of current roles available in the system. Like Subscriber / Admin. User can select a role and when invitation code is created the invitation code is associated with the role. what can I do ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Sending invitation codes?’ is closed to new replies.