Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: GL700Wing on January 08, 2021, 09:30:46 PM

Title: Image for Anti-Spam Verification Questions
Post by: GL700Wing on January 08, 2021, 09:30:46 PM
Link to the mod (https://custom.simplemachines.org/index.php?mod=4278)

Image for Anti-Spam Verification Questions

Custom Image for use with Anti-Spam Verification Questions

Following on from a tip (https://www.simplemachines.org/community/index.php?topic=575145.msg4070373#msg4070373) shared by Sir Osis of Liver (https://www.simplemachines.org/community/index.php?action=profile;u=424443) this mod has been created to enable Admins to use a custom image for the anti-spam verification questions that are created via Administration Center >> Security and Moderation >> Anti-Spam.  The custom image will be displayed everywhere verification is required (eg, registration, guest searches, guest posting, guest reporting posts, etc).

Suggestion: Save the verification image to the forum default theme images folder (eg, ./Themes/default/images).

This mod also includes some safeguards just in case the verification image cannot be accessed via the supplied URL and/or if the verification image cannot be seen on the pages on which it is displayed:
1.  A message will be displayed in the Admin Center if the verification image URL is not valid; and
2.  On the pages on which the verification image is displayed a link to contact the webmaster is provided if the verification image cannot be seen.

Also, and even though the verification image size is displayed at a maximum pixel resolution of 300x300 on the registration page, the full-sized version of the image will be displayed in a new window/tab by clicking on it.


Release History:
1.0 - 28-Dec-20
o Initial Release with support only for SMF 2.0.17

1.0 - 09-Jan-21
o Added installer support for SMF 2.0.18 (no code change for mod)

1.1 - 25-Jul-21
o Added support from SMF 2.1 RC4
o Minor layout improvement for SMF 2.0

1.2 - 02-Jan-22
o Bug fix for SMF 2.1 RC4




License
Copyright 2020-2022 Kathy Leslie

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Title: Re: Image for Anti-Spam Verification Questions
Post by: Mick. on January 09, 2021, 08:17:36 AM
Very cool. I dig it.
Title: Re: Image for Anti-Spam Verification Questions
Post by: GigaWatt on January 09, 2021, 10:40:35 AM
Mhm, very cool ;).
Title: Re: Image for Anti-Spam Verification Questions
Post by: Steve on January 09, 2021, 02:56:12 PM
Nicely done, GL!
Title: Re: Image for Anti-Spam Verification Questions
Post by: Dave J on July 03, 2021, 07:51:11 AM
Just wanted to say that I think this is great. I created my own image to use also.

Thank you GL
Title: Re: Image for Anti-Spam Verification Questions
Post by: GL700Wing on July 26, 2021, 02:25:30 AM
Uploaded 1.1 - 25-Jul-21
o Added support from SMF 2.1 RC4
o Minor layout improvement for SMF 2.0 versions
Title: Re: Image for Anti-Spam Verification Questions
Post by: Dave J on July 26, 2021, 03:57:55 AM
Quote from: GL700Wing on July 26, 2021, 02:25:30 AM
Uploaded 1.1 - 25-Jul-21
o Added support from SMF 2.1 RC4
o Minor layout improvement for SMF 2.0 versions

GL should we uninstall the old version before installing the update?

Ignore that..the answer is yes just tested it on my test site and you need to uninstall the old one first.
Title: Re: Image for Anti-Spam Verification Questions
Post by: landyvlad on December 02, 2021, 07:42:58 PM
I have an issue.

I have installed this mod v1.1 on 2.1RC4
image lives in the public_html directory with URL set as https://ytyak.com/antispam.png

In the admin section I can see it and set it up HOWEVER when I go to register as a new user the image does not appear!

Solution?
Title: Re: Image for Anti-Spam Verification Questions
Post by: Diego Andrés on December 02, 2021, 09:24:48 PM
Not sure if that'd break it but the mod adds this to the css
/* Image for Anti-Spam Verification Questions Mod */
input#qa_verification_image_url
{
width: calc(100% - 20px);
}

Did you also install it on your current theme?
Title: Re: Image for Anti-Spam Verification Questions
Post by: landyvlad on December 03, 2021, 03:44:42 AM
I'm not sure what you mean by "Not sure if that'd break it but the mod adds this to the css" ?


Yep sure did install on current theme.
Title: Re: Image for Anti-Spam Verification Questions
Post by: landyvlad on December 06, 2021, 04:41:47 PM
I had someone else check and they told me:

QuoteIt's not working for me either, on any 2.1 theme, including default.

I upload the image and can view it in my browser, so I copy the full image URL directly from the browser and paste it in the admin Anti Spam page ...... and I get "ERROR - The URL for the verification questions image is invalid!"

Is there a specific place the image needs to be uploaded to?
Title: Re: Image for Anti-Spam Verification Questions
Post by: shadav on December 06, 2021, 05:57:20 PM
Quote from: GL700Wing on January 08, 2021, 09:30:46 PMSuggestion: Save the image you want to use to the forum's 'images' folder.
I'm not sure if that means to create a folder in the forum root named images or if that means in the default themes image folder
looking at the parse of the mod I'm assuming you put the url of the image somewhere in your admin
Title: Re: Image for Anti-Spam Verification Questions
Post by: GL700Wing on December 08, 2021, 02:12:47 AM
Quote from: landyvlad on December 06, 2021, 04:41:47 PMIs there a specific place the image needs to be uploaded to?
The image needs to be uploaded to a folder/directory that guests have read access to - on the forum where I use this mod the verification image is saved as https://my-forum.com/forum/images/verification.jpg
Title: Re: Image for Anti-Spam Verification Questions
Post by: landyvlad on December 08, 2021, 07:11:14 PM
OK I'll try that ta.
Title: Re: Image for Anti-Spam Verification Questions
Post by: landyvlad on December 21, 2021, 01:29:24 AM
Quote from: GL700Wing on December 08, 2021, 02:12:47 AMThe image needs to be uploaded to a folder/directory that guests have read access to - on the forum where I use this mod the verification image is saved as https://my-forum.com/forum/images/verification.jpg
Hmm I had a look and my 2.1 forum is in the root directory (eg public_html) and there is no images folder.
What I have is
Quotepublic_html
.well-known
attachments
avatars
cache
custom_avatar
Packages
Smileys
Sources
Themes
TinyPortal
tp-downloads
tp-files
tp-images

So the only image folders are that for TinyPortal and one buried several levels deep in each of the the theme folders.
I just tried putting in the featehr theme images folder (my forum default) and updating the URL in teh anti-spam section (above the questions) but it is still not visible when attempting to register as a new member.

Advice?
Title: Re: Image for Anti-Spam Verification Questions
Post by: GL700Wing on December 21, 2021, 05:11:24 AM
I created the 'images' folder/directory in the 'forum' folder/directory and copied the verification image there ...
Title: Re: Image for Anti-Spam Verification Questions
Post by: landyvlad on December 27, 2021, 12:46:38 AM
So a new subfolder in the main public_html called 'images' ?
Title: Re: Image for Anti-Spam Verification Questions
Post by: Dave J on December 27, 2021, 05:30:20 AM
Quote from: landyvlad on December 27, 2021, 12:46:38 AMSo a new subfolder in the main public_html called 'images' ?


Yes
Title: Re: Image for Anti-Spam Verification Questions
Post by: GL700Wing on December 27, 2021, 05:47:36 AM
Quote from: landyvlad on December 27, 2021, 12:46:38 AMSo a new subfolder in the main public_html called 'images' ?
I use a folder/directory named 'images' in the main folder/directory of my forum (ie, it's at the same level as Packages, Smileys, Sources, Themes, etc).

Definitely working on my SMF 2.0 forum ...
Title: Re: Image for Anti-Spam Verification Questions
Post by: landyvlad on December 29, 2021, 01:33:15 AM
OK well I have done that - the file is in a folder called images in the same directory as poer GL700 above.

In the anti-spam settings I have nominated the image location as

Under admin - configuration - anti-spam
Verification questions image URL is set to https://ytyak.com/images/antispam.png
Number of questions required is set to 2.

I can see it there as an admin, BUT if I log out and try to register as a new member
https://www.ytyak.com/index.php?action=signup
it still doesn't show up.

Thoughts?
Title: Re: Image for Anti-Spam Verification Questions
Post by: GL700Wing on December 29, 2021, 03:05:49 AM
PM sent ...
Title: Re: Image for Anti-Spam Verification Questions
Post by: GL700Wing on January 01, 2022, 11:32:24 PM
Uploaded 1.2 - 02-Jan-22
o Bug fix for SMF 2.1 RC4


@landyvlad - The SMF 2.1 RC4 issue you were experiencing was caused by a missing variable definition - now fixed!
Title: Re: Image for Anti-Spam Verification Questions
Post by: Shades. on January 10, 2022, 07:28:18 PM
Nice mod! 8)

How can I have the link that says "Help - I can't see the verification image!" on registration page point to my contact page (action=contact) instead of directly linkng to and showing my email address?
Title: Re: Image for Anti-Spam Verification Questions
Post by: GL700Wing on January 11, 2022, 06:37:14 PM
Quote from: Shades. on January 10, 2022, 07:28:18 PMNice mod! 8)[/url]
Thanks

QuoteHow can I have the link that says "Help - I can't see the verification image!" on registration page point to my contact page (action=contact) instead of directly linkng to and showing my email address?
I assume you're using the Contact Page (https://custom.simplemachines.org/index.php?mod=377) mod ...

I've had a look at this but it's not as simple as I had hoped because if verification questions/answers (with or without an image) are enabled sending a message via the contact page requires the verification questions to be answered ...

I'll keep working on integrating this mod with the Contact Page mod ...
Title: Re: Image for Anti-Spam Verification Questions
Post by: Shades. on January 11, 2022, 06:45:41 PM
Quote from: GL700Wing on January 11, 2022, 06:37:14 PMI assume you're using the Contact Page (https://custom.simplemachines.org/index.php?mod=377) mod ...

I've had a look at this but it's not as simple as I had hoped because if verification questions/answers (with or without an image) are enabled sending a message via the contact page requires the verification questions to be answered ...

I'll keep working on integrating this mod with the Contact Page mod ...
Yes thanks! :)

(Oh I see how that could complicate things!)

Edited to say: Kinda defeats the purpose of the contact mod now I think about it cause the email will be exposed on the contact page! :o
Title: Re: Image for Anti-Spam Verification Questions
Post by: Shades. on January 11, 2022, 07:20:10 PM
Quote from: GL700Wing on January 11, 2022, 06:37:14 PMI'll keep working on integrating this mod with the Contact Page mod ...

Meanwhile can I cut out the part of the code that shows the "Help - I can't see the verification image!" section and if so can you tell me what code to remove?

And just a thought (I don't know how it works) but is there a way to show an error in admin when an image is not working or maybe the guest could click that link that goes to email and it just automatically sends an error to admin or something along those lines? (I know it would have to be coded, if even possible at all)

But I like this mod and would be happy if I could just remove that part of the code! ;)

(Edited to say: I found it in modifications.english.php thanks!)

Thanks! 8)