MyBB Community Forums

Full Version: Change username if checkbox is ticked
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This isn't a plugin, just a little modification I want to do. Basically, I have a checkbox next to the Signature, Disable Smilies, Close Thread and Stick Thread checkboxes, which I added in the showthread_quickreply template like so:

<label><input type="checkbox" class="checkbox" name="example" value="1" checked="checked" />&nbsp;<strong>Example</strong></label>

[attachment=23922]

If users tick that checkbox in the Quick Reply form (or the newreply.php page) their username in the post should be "Example", which will link to nothing. Much like how guest posts work. I tried adding this in ./inc/functions_post.php around line 94:

if(isset($_POST['example']))
{
	$post['username'] = "Example";
}

But nothing really happens. A few minutes later I realized that didn't make much sense anyway. I'm pretty much stuck now, as I lack the PHP skills to figure this one out. Could anyone give me some pointers? What file(s) should be edited? How exactly?

Thanks! Angel
Wouldn't be easier to have an account of that name so you could just use that ID for it?
But then the post would belong to that user, no? I don't really want to change the username per say, just replace what's being output with "Example". I think that would be easier. The details on the right are already hidden, so they're not a problem.