I will try this out later thank you!Create a custom user field and set it to mandatory on registration. There is a verification callback for custom user fields, so you could use that to verify the invitation code.
@S Thomas Hey, I'm currently having a problem when I'm trying to setup the callback it keeps giving me an errorCreate a custom user field and set it to mandatory on registration. There is a verification callback for custom user fields, so you could use that to verify the invitation code.
Callback Voltz\Invitation\InvitationCallback::validate is invalid (error_invalid_class).
Can you create a screenshot of your custom user field? Only the part with the callback is needed. And probably your file structure would be handy aswell.


Yeah I got it working thanks!No, if you've done it like a controller, everything is fine. Just to make sure,Voltzis in/src/addons/, right?
Is your class within InvitationCallback also called InvitationCallback?
How can I check if is from the admin controller in the callback? (Sorry just started doing stuff with XenForo)Not sure, but you could check if the request controller is an admin controller and in that case skip the verification in your callback.
Creating a custom user field during installation should be fairly easy, but I don't know from memory how to do it.
// via app
(\XF::app->container()->__get("app.defaultType") === "admin")
(\XF::app->container()->__get("app.classType") === "Admin")
//generally ignore when admin or staff
(\XF::app->visitor()->is_admin || \XF::app->visitor()->is_super_admin || \XF::app->visitor()->is_staff)
Again unsure what would be the best method, but you could do sth like
PHP:// via app (\XF::app->container()->__get("app.defaultType") === "admin") (\XF::app->container()->__get("app.classType") === "Admin") //generally ignore when admin or staff (\XF::app->visitor()->is_admin || \XF::app->visitor()->is_super_admin || \XF::app->visitor()->is_staff)
/* Check if callback is being called from admin controller */
if ($app->container()->__get('app.defaultType') === 'admin' || $app->container()->__get('app.classType') === 'Admin')
{
return true;
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.