XF 2.1 All bot_type values must be unique

Ozzy47

Well-known member
So trying to add items to the register form. I get so far then I get hit with this error.

Oops! We ran into some problems.
All bot_type values must be unique.


Does anyone know where that error is coming from?

I am redoing a addon that completely replaced the register_form template, and that way it worked fine. But breaking my replacements into separate TM results in that error.
 
To add to this, when I do add a TM and that error comes up, disabling the TM does not stop the error. I have to uninstall the addon then reinstall.

Could that be due to the _data folder being present in the addon folder?
 
Are you sure the error is related to a TM and not one of your PHP files?
The error phrase seems to be all_x_values_must_be_unique which is called from the Mvc\Entity\Entity.php file function set() which in turn calls function _verifyUniqueValue()
Not sure where your bot_type comes into play though.
 
I almost have to believe it is from a TM. The addon works as is, but when I break out the changes to the registration from individually then I get the error.

The template code is the same as it is in the complete replacement, just individualized. The PHP files remain unchanged.

It's quite puzzling.
 
Until someone who can actually help you joins this thread, all I can think of is to ensure that each modification is actually accepted/works (ie green) and that it only modifies the code the correct amount of times (ie does not change more lines/locations than you wish it to).
 
Until someone who can actually help you joins this thread, all I can think of is to ensure that each modification is actually accepted/works (ie green) and that it only modifies the code the correct amount of times (ie does not change more lines/locations than you wish it to).

Thanks for additional insite. I'll have to have a look again when I get some time.
 
Hmm, finally managed to get a server error.

Code:
ErrorException: Template error: Macro public:corehp_macros:usernamesdsdfdsf_row is unknown src/XF/Template/Templater.php:586
Generated by: Unknown account Aug 4, 2019 at 10:27 PM

Stack trace
#0 [internal function]: XF\Template\Templater->handleTemplateError(512, 'Macro public:co...', '/home/ozzmodz/p...', 586, Array)
#1 src/XF/Template/Templater.php(586): trigger_error('Macro public:co...', 512)
#2 src/XF/Template/Templater.php(700): XF\Template\Templater->getTemplateMacro('public', 'corehp_macros', 'usernamesdsdfds...')
#3 internal_data/code_cache/templates/l1/s1/public/register_form.php(80): XF\Template\Templater->callMacro('corehp_macros', 'usernamesdsdfds...', Array, Array)
#4 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array)
#5 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('register_form', Array)
#6 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#7 src/XF/Mvc/Dispatcher.php(418): XF\Mvc\Renderer\Html->renderView('XF:Register\\For...', 'public:register...', Array)
#8 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#9 src/XF/Mvc/Dispatcher.php(360): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#10 src/XF/Mvc/Dispatcher.php(53): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#11 src/XF/App.php(2178): XF\Mvc\Dispatcher->run()
#12 src/XF.php(390): XF\App->run()
#13 index.php(20): XF::runApp('XF\\Pub\\App')
#14 {main}

Request state
array(4) {
  ["url"] => string(17) "/dev/xf2/register"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

The code in the template for that particular error:
HTML:
<xf:macro name="username_row">   
        <xf:comment>Spam catcher field</xf:comment>
            <xf:textboxrow name="username" value="" autocomplete="off"
              rowclass="formRow--limited"
              autofocus="{{ $autoFocus ? 'autofocus' : false }}"
              maxlength="{{ $xf.options.usernameLength.max ?: max_length($xf.visitor, 'username') }}"
              label="{{ phrase('user_name') }}"
              hint="{{ phrase('required') }}"
              explain="{{ phrase('spaminator_retype_username') }}" />
</xf:macro>
 
I might have figured out why I get the error. There are more but I will provide an example.

In one TM I remove this code from the register_form template. It has an execution order of 5.
HTML:
            <xf:comment>Spam catcher field</xf:comment>
            <xf:textboxrow name="username" value="" autocomplete="off" rowclass="formRow--limited"
                maxlength="{{ max_length($xf.visitor, 'username') }}"
                label="{{ phrase('user_name') }}"
                explain="{{ phrase('please_leave_this_field_blank') }}" />

Then in another TM, I add this bit of code. It has an execution order of 10.
HTML:
<xf:macro template="corehp_macros" name="username_row" />

Now in the corehp_macros template the code for that macro is.
HTML:
<xf:macro name="username_row">   
        <xf:comment>Spam catcher field</xf:comment>
            <xf:textboxrow name="username" value="" autocomplete="off"
              rowclass="formRow--limited"
              autofocus="{{ $autoFocus ? 'autofocus' : false }}"
              maxlength="{{ $xf.options.usernameLength.max ?: max_length($xf.visitor, 'username') }}"
              label="{{ phrase('user_name') }}"
              hint="{{ phrase('required') }}"
              explain="{{ phrase('spaminator_retype_username') }}" />
</xf:macro>

So, could it be because both the old code and new code have the same name="username"? If so I surely would have thought the different execution orders would prevent that from clashing.
 
Top Bottom