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).
Thread Starter
orboan
(@orboan)
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!
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 = '[email protected]';
wp_mail( $to_user, $msg ); // This mail came "from" your "admin email"
endif;
2- See above π
Thread Starter
orboan
(@orboan)
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.
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 π
@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?
back-end.php:124,140
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 ?