WordPress.org

Ready to get started?Download WordPress

Forums

Easy Invitation Codes
[resolved] Sending invitation codes? (12 posts)

  1. orboan
    Member
    Posted 1 year ago #

    Hello,
    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?

    http://wordpress.org/extend/plugins/baw-invitation-codes/

  2. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    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).

  3. orboan
    Member
    Posted 1 year ago #

    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!

  4. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    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"
    endif;

    2- See above ;)

  5. orboan
    Member
    Posted 1 year ago #

    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.

  6. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    Good news :)

  7. spoeken
    Member
    Posted 1 year ago #

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

  8. spoeken
    Member
    Posted 1 year ago #

    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.

  9. zanozik
    Member
    Posted 1 year ago #

    $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 :)

  10. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    @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 ;)

  11. zanozik
    Member
    Posted 1 year ago #

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

    back-end.php:124,140

    function baweic_fields_cb2($val){
    ...
    $temp = strtoupper($prefix . wp_generate_password($length, false));

  12. sayeed100s
    Member
    Posted 1 year ago #

    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 ?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.