XF 2.0 Trophy criteria, custom fields, check for existence of any value

Wildcat Media

Well-known member
This is sort of a continuation of an issue that came up in XF 1.x. When creating a trophy using custom fields, we have a choice to check to see if a chosen field contains specific text. However, there appears to be no wildcard option, and that is holding up something we would like to implement.

Here is a sample of a typical custom field I am describing:

1519706075086.webp

There was a quick hack written by @Jake Bunce here: https://xenforo.com/community/threads/creating-custom-trophies.31248

@Mike and @Brogan explained the behavior here: https://xenforo.com/community/threads/trophy-personal-details-question.94313

Like the other threads mention, we need to check only for the existence of something in this field, not any specific text. Thinking about it a little further, unless we are looking for some really specific text in what could be a lengthy field (these fields will generally have a lot of random content--specific content I feel is best triggered by checkboxes and radio buttons), it only makes sense that perhaps there should be an additional checkbox to check for a non-empty field. Or at the very least, change the behavior so that if the text field is blank, it will check for existence of any content in the field. (Hint text in this box could say, "Leave empty to check for any entry in this field".)

1519706805838.webp

The only reason we want to attach a trophy to one specific field is that filling this rather large field out is a requirement for participating in some of our forum areas, and want to reward members who do so as an enticement.

Another question. The way it works now, if we check the box but leave the field blank, what is the behavior? Does this now check for an empty string (empty field), or is it ignored?

I am testing this in our non-public XF2 forum, so I am able to experiment. Suggestions welcome. :)

And perhaps, this could be moved over to the Suggestions forum if no other solutions arise?
 
Did you get this sorted @Wildcat Media?

I'm also running into issues with this.

We've got a ton of custom user fields for users to fill out to add info about themselves to share with the community on their profile, and checking for exact content or guessing some content that is going to be in it is pretty much impossible.

On free form text boxes in particular we need to be able to check if they've added any content at all.

It's also an issue with URLs for getting people to share their socials seeing as so many companies use a combination of normal and shortened URLs. We can just watch one value, we'd like to see if they've added just something to the field.

Did you try to fix from Jakes from 8 years ago? Looks like it might still work, but now in src -> XF -> Criteria -> User.php

I'd rather not hard code a change though.
 
I totally forgot about this. I never bothered to pursue it since coding anything like that is way above my skill set these days. I did just vote on the suggestion you found, though. I don't think too many members really care about trophies in our forums, to be honest, but I still would like a way to award the few who care about that sort of thing. It's also enlightening to look at a person's list of trophies to see their development in the forum throughout the years.
 
Top Bottom