I'm trying to se up unique user names without registration, this could end up with having same user names and I can't say "see all posts by this user" as users could have the same name.
Basically I am using this wordpress plugin called User Submitted Posts which is great as user can post an article without registration, but there is the duplicate name issue, so I thought a solution could be that we have an input field:
<input name="user-submitted-name" type="text" value="" data-required="true" required placeholder="Your name" class="form-control input-lg usp-input">
And we add a random unique string to the output in order to have:
User 1: simon_xyz
User 2: simon_abc
I guess it's quite simple to generate a random string in php, founds lots of stacks that help me on that such as this question: PHP random string generator
But ideally i want to tell the user something like "This is you username, copy it and always use this". There won't be an email requirement as there isn't a registration, so how to add a random unique string to an input field value and show the result live?
I am using this jQuery to add the value of a checkbox to the input field for something else on the site:
$('.checkTag').click(function() {
$("#user-submitted-tags").val(
$('.checkTag:checked').map(function() {
return $(this).val();
}).get().join(', ')
);
});
Perhaps something like that could be used but i'm struggling as the random string isn't something you would select.
The live result would be something like:
<h2>This is your username</h2>
<h3>Use this user name the next time you write your post</h3>
<p>Your usernanme is: simon_xyz</p>