• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

remove guest names?

zaiger

Active member
#1
I am trying to remove my guest's ability to choose their own name. I would like every guest post to come from the same username. Preferably I would like guests to post from a pre-defined user account, but that may be too complicated. Having every guest post as a "Guest" with the username "Guest" would work almost as well for me. Any ideas?
 

Jake Bunce

XenForo moderator
Staff member
#2
Admin CP -> Appearance -> Templates -> thread_reply

Replace this code:

Code:
	<xen:if is="{$visitor.user_id} == 0">
		<dl class="ctrlUnit">
			<dt><label for="ctrl_guestUsername">{xen:phrase name}:</label></dt>
			<dd><input type="text" name="_guestUsername" value="{$visitor.username}" class="textCtrl" /></dd>
		</dl>
	</xen:if>
With this:

Code:
	<xen:if is="{$visitor.user_id} == 0">
		<input type="hidden" name="_guestUsername" value="Guest" />
	</xen:if>
You need to make the same change to this template:

Admin CP -> Appearance -> Templates -> thread_create

Just make sure no one registers the name "Guest" or guests will no longer be able to post because the name is in use.
 

Brogan

XenForo moderator
Staff member
#3
Just make sure no one registers the name "Guest" or guests will no longer be able to post because the name is in use.
You could add it to the list of disallowed words in Options -> User Registration

I presume that won't stop the name being used, just registered with.
 

zaiger

Active member
#4
Thanks a lot guys. I forgot that you couldn't have a guest with the same name as a registered user, which makes total sense, I just didn't think about that. Would it be terribly difficult to assign all guests to a single account? I have seen addons like the 'anonymous posting' or the 'ragtek new user notification system' where automated and manual posts are assigned to a user in the ACP, however I don't need a fancy options menu. Would that work if I put the user ID that I would like guests to post from into the template in the same way? Like say here:
Code:
xen:if is="{$visitor.user_id} == 0"
and then changed the value underneath it to that account?
 

zaiger

Active member
#6
Boooo :oops:

Maybe this is a good opportunity to make my first addon. Any advice as to the best way to implement an extension for the specific changes I am looking for?