View Full Version : Extra Field when posting New Thread
BasilFawlty
03-25-2018, 01:08 PM
This may exist, but I did several searches and didn't see anything. What I would like to do is have an extra field on the "newthread" forum, but only for certain forums I designate. I have a few forums that are "Classifieds" forum and I'd like to have an extra field, probably just below the Title field, called "Ad Link" (or similar). Then, if someone is posting a classified ad and they have the item also on Ebay or Craigslist, for example, they could paste their link into that field (optionally).
Then, when they save their post, "IF" that field is not empty, that link would get parsed and posted at the end of their regular text. The mod would also look at the first X string of characters in the URL they entered and, for example, if the string contains "Ebay" then the link might look like this:
EBay (https://www.ebay.com/itm/Canon-EOS-5D-Mark-IV-Digital-SLR-Camera-Body-Only/323086614873?epid=230154655&hash=item4b39768159:g:6p4AAOSwXkRZynZQ)
snakes1100
03-25-2018, 04:09 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=269667" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=269667</a>
BasilFawlty
03-25-2018, 04:19 PM
https://vborg.vbsupport.ru/showthread.php?t=269667
That looks like it! Thank you thank you thank you!
snakes1100
03-25-2018, 04:22 PM
welcome welcome welcome!
MarkFL
03-27-2018, 12:18 AM
As promised via PM, I have attached a product that will give you two additional text input fields, below the title field for new threads. You can set in which forums the product is active, and for which usergroups.
The two input fields use pattern recognition to try to ensure valid text is entered. There are settings where you can modify the pattern.
The links are built and displayed beneath the content of the first post in the thread, but they aren't actually part of the post in the database. You can control the color of the links with the StyleVars.
This product adds a table to your database which stores the threadid, and the two links for any thread having links associated with them.
Please let me know if you have any issues, or would like additional features. :)
BasilFawlty
03-27-2018, 02:22 AM
Almost there Mark! Tested it on my site (PMd you a video of the test). Works but a couple issues. First, it would be great if the links that get posted would open in a new tab (minor personal preference). When you enter two links (both an Ebay and a Craig's List link) it posts both links perfectly. However, if you only post with an Ebay link in the Ebay field, it still posts a "Craigs List" link, but the link only goes to the home page when you click. If you post only a CL link and put noting in the Ebay field, then neither gets posted.
Hope this helps.
MarkFL
03-27-2018, 02:41 AM
Almost there Mark! Tested it on my site (PMd you a video of the test). Works but a couple issues. First, it would be great if the links that get posted would open in a new tab (minor personal preference). When you enter two links (both an Ebay and a Craig's List link) it posts both links perfectly. However, if you only post with an Ebay link in the Ebay field, it still posts a "Craigs List" link, but the link only goes to the home page when you click. If you post only a CL link and put noting in the Ebay field, then neither gets posted.
Hope this helps.
Your video was superb! :D
I have addressed the issues you reported, and am now attaching the update...
BasilFawlty
03-27-2018, 03:11 AM
I would say you nailed it! All options - with both links, with either link, or with no links - all cases work as they should. Super duper! Thank you! If I run across any bugs I'll let you know.
MarkFL
03-27-2018, 03:13 AM
I would say you nailed it! All options - with both links, with either link, or with no links - all cases work as they should. Super duper! Thank you! If I run across any bugs I'll let you know.
Good deal! :up:
Also, if you find you want any added features, just let me know...I'll be glad to see what I can do. :)
BasilFawlty
03-27-2018, 03:38 AM
Good deal! :up:
Also, if you find you want any added features, just let me know...I'll be glad to see what I can do. :)
Well, since you asked - if I wanted to play around with font size and link color for the links, would that be something I could just modify myself and if so, where would I do that?
MarkFL
03-27-2018, 04:12 AM
The color of the individual links can be changed with the StyleVars in the Style Manager, and in the attached update I have added a StyleVar for the font size (affects both), which I set to default at 125%.
Tomorrow, I will move all inline CSS to a .css template and create class selectors. :)
MarkFL
03-27-2018, 12:58 PM
Latest update: all CSS has been moved to templates. :)
MarkFL
03-27-2018, 03:41 PM
I've added some javascript (tested in Firefox and Chrome) which makes the error messages more user friendly when invalid input is given.
BasilFawlty
03-27-2018, 06:33 PM
I've added some javascript (tested in Firefox and Chrome) which makes the error messages more user friendly when invalid input is given.
Seems to be working great.
--------------- Added 1522205160 at 1522205160 ---------------
I spoke too soon. Found a weird bug - will PM details with video.
MarkFL
03-28-2018, 11:18 AM
I found the issue, and resolved it...here is the update...
BasilFawlty
03-28-2018, 12:54 PM
Adding the “not private script” seems to have done it!
MarkFL
03-28-2018, 01:05 PM
Actually, what I think what did it was moving the global declaration of the $post array inside the if block, but I left the "not private script" condition as an extra, since it does not need to run there (even though the forum condition would likely keep it from running anyway). :)
BasilFawlty
03-28-2018, 01:38 PM
I see, that makes sense. Speaking of link mods, something I see on another forum I frequent that I think would make a very cool mod (if it doest already exist). This would be mod that would work for most any link to show a preview of the linked item instead of just a flat link. Sort of like when you post a news article to your messaging app and it generates a small preview image of the article. Maybe this sort of mod already exists, but if it didn't - it would be a great update to VB to provide for any links to generate a preview if possible. Here's a picture of an example from that other forum. (not a VB forum but rather a home brew forum)
http://www.britishcarforum.com/bcf/images/preview_link.jpeg
MarkFL
03-28-2018, 02:01 PM
It reminds me of an IPS forum. :)
BasilFawlty
03-28-2018, 03:54 PM
It reminds me of an IPS forum. :)
It's a forum I belong to for Jaguars cars. :cool: (They coded it from scratch so it's proprietary)
--------------- Added 1522337036 at 1522337036 ---------------
I found the issue, and resolved it...here is the update...
Thanks a million - BTW, I just made a donation to your Math site!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.