Log in

View Full Version : Board Optimization - [Ajax] Best Answer


emath
04-27-2016, 09:00 PM
This is a quite simple and effective mod to select a post as Best Answer .

see readme file before installing .

Donations are always welcome :)

------------------------------------------------
## Features ##


Allow to select/unselect post as 'best answer'
Best answer is bumped ( duplicated ) to the top
Best answer post has an indication 'best answer' on top of the post
[SOLVED] prefix is added to threads with best answer, this will not replace any exiting prefix.
Can be configured to apply for specific forums only
By default, only the one who opened the thread can select/unselect a post as best answer
Pemissions allowing select as 'best answer' can be add for specific user groups
on/off configuration


## HOW TO INSTALL ##


upload the content of the upload folder into your forum root directory
import the XML file as new product
go to settings -> options -> best answer and configure the product as u wish


## Style - css ##

The mod doesn't come with any particular css with it, as each forum has its own style.
With that said, all of the mod related html elements were attached to class so adding css is easy .

In addition, there is example.css file which can be used for those who want the css i wrote .
just add it to additional.css or wherever u like this css to be .

## Compatability ##

was tested over vB4.2.2 nad vB4.2.3 but should work with any vB4.x .

use this at your own risk, always backup your database before installing any new mod !

## Changelog ##

V1.9

- bug fix, handle deleted posts

V1.8

- bug fix : show best answer only in first page
- bug fix : first post in second page could not be selected as 'best answer'
- bug fix in plugins ( add global $vbulletin; at top of each plugin )
- verified that works with 4.2.3

V1.3

- bug fix : change exection order of plugin from 1 to 5

V1.2

- changed loading script from 'async' to 'defer'
- add uninstall code

## license ##

MIT license

## Q & A ##

How can i find my forum ids ?

read here : http://www.vbulletin.com/forum/forum/vbulletin-legacy-versions-products/legacy-vbulletin-versions/vbulletin-3-6-questions-problems-and-troubleshooting/217932-how-do-you-find-the-forum-id-of-a-forum

mysimsek
04-29-2016, 04:25 AM
I don't understand the changes to the database

emath
04-29-2016, 04:49 AM
I just mentioned what database changes there is, I've removed that section .

Sforums
04-29-2016, 06:47 AM
Using 4.1.0 myself. Upon installing it took almost 5 minutes to open single topic.
Uninstalled.

emath
04-29-2016, 08:04 AM
Using 4.1.0 myself. Upon installing it took almost 5 minutes to open single topic.
Uninstalled.

I'm not familiar with any such errors.
By topic u meant thread ? And did the installation went good ?
Please provide a link to your forum ( if u have a test forum, PM it to me and I will check it, I don't have a vb4.1 and I cannot reproduce it over 4.2)

MarkFL
04-29-2016, 05:56 PM
Hello fellow math enthusiast! :D

You could remove the need for editing the "SHOWTHREAD" template by adding a plugin hooked at "parse_templates" with the following Plugin PHP Code:

if (THIS_SCRIPT === 'showthread')
{
$javascript = '<script type="text/javascript" src="./bestAnswer/bestAnswer.js?version=0"></script>';
$template_hook['headinclude_javascript'] .= $javascript;
}

In the conditional, you should add any other conditions you want to be true before the script is added, such as whether the product is enabled, if the browsing user has permission to use the button, etc.

Adding the version number parameter (which you should increment anytime you change that .js file when you upload an update of this product here) will ensure the new version is loaded by browsers, rather than using the cached older version which browsers will do unless the cache is cleared.

Manual template edits will keep some folks from trying a product (hacking templates is rightfully frowned upon by many, and in addition template hacks have to be done for each active style), and so I wanted to offer a little help to remove that need. :)

emath
04-29-2016, 08:04 PM
yeah i know, I've also could use showthread_below_posts template hook,

I didn't find it right to add a hook for script src tag, because then it will be 'hidden' and some like to bundle and minify all their javascript files, but i guess you are right.

I've added async attirbute to the script tag so it won't block any content .

The product has been updated and now no template edits are needed .

Thanks .

mysimsek
04-30-2016, 06:05 AM
unfortunately it did not work

emath
04-30-2016, 06:12 AM
unfortunately it did not work

What didnt work ? Could u explain what did u try to do and what went wrong ?

emath
05-01-2016, 03:03 PM
mysimsek, maybe the update will fix your issue

## Changelog ##

V1.2

- changed loading script from 'async' to 'defer'
- add uninstall code

mysimsek
05-05-2016, 09:36 PM
unfortunately, it doesn't look a thing in postbit

emath
05-06-2016, 05:16 AM
did u set the usergroups and forum ids in the configuration ?

see pm..

emath
05-07-2016, 09:44 AM
V1.3

- bug fix : change exection order of plugin from 1 to 5

dpixi
05-12-2016, 06:46 AM
Hi,

what do i have to enter in "allowed user groups to select best answer" ids?

i dont get the "best answer" button to show up beside posts

emath
05-12-2016, 11:30 AM
Hi,

what do i have to enter in "allowed user groups to select best answer" ids?

i dont get the "best answer" button to show up beside posts

The numbers of the user groups,separated by comma, that will have a permissions to select a post as best answer ( except the user who opened the thread ). Usually u will insert here the admins usergroup ids

The number of the usergroups can be seen in admin panel -> user groups -> manage usergroups

emath
06-02-2016, 03:59 PM
I've updated the docs a bit

TeckTP
06-09-2016, 08:18 AM
Hi.
I installed plugin, but I totally do not know what to do next.
I imported the XML file, in the Admin Panel > Options > Best Answer l is visible option.
I set up groups with commas ex: 2,4,5
I do not know how to set up a forum ID if it is to be ex: 2-Help

Where embed CSS? Sorry for asking, but really this plug is very necessary to us;)

emath
06-10-2016, 05:22 AM
Hi.
I installed plugin, but I totally do not know what to do next.
I imported the XML file, in the Admin Panel > Options > Best Answer l is visible option.
I set up groups with commas ex: 2,4,5
I do not know how to set up a forum ID if it is to be ex: 2-Help

Where embed CSS? Sorry for asking, but really this plug is very necessary to us;)

hey,

to find your forum ids read here :

http://www.vbulletin.com/forum/forum/vbulletin-legacy-versions-products/legacy-vbulletin-versions/vbulletin-3-6-questions-problems-and-troubleshooting/217932-how-do-you-find-the-forum-id-of-a-forum

it should be just a number, no text .

regard the CSS, anywhere that applies on the showthread/showforum is ok, for example, you can add it in your additional.css file.

let me know if you still have issues or they are resolved

TeckTP
06-10-2016, 08:17 AM
let me know if you still have issues or they are resolved

Unable to start the plug.
I send screenshots how it looks on the server and in the panel
155122

155123

155124

155125

155126

155127

155128

emath
06-10-2016, 09:33 AM
Unable to start the plug.
I send screenshots how it looks on the server and in the panel


see pm

TeckTP
06-10-2016, 09:51 AM
Thanks i wrote :) see PM

emath
06-10-2016, 11:49 AM
Thanks i wrote :) see PM

works in your board now :)

TeckTP
06-10-2016, 12:48 PM
Thank you very much. I have one question in the screen https://vborg.vbsupport.ru/attachment.php?attachmentid=154864&d=1461861842 you have mark thread "SOLVED" does it separate plug ?

emath
06-11-2016, 04:02 AM
Thank you very much. I have one question in the screen https://vborg.vbsupport.ru/attachment.php?attachmentid=154864&d=1461861842 you have mark thread "SOLVED" does it separate plug ?

no, its the same one - you have also in your board... look in forum 11 ( Play-Internet )

[SOLVED] prefix is added to threads with best answer, this will not replace any exiting prefix.

TeckTP
06-11-2016, 07:54 AM
The last question. The topics in the first few pages of a web page can not be selected even though it is not the first post in the topic . You know the case?

emath
06-11-2016, 08:16 AM
The last question. The topics in the first few pages of a web page can not be selected even though it is not the first post in the topic . You know the case?

thank you for your feedback, I've fixed that .

just reimport product-voteandanswer.xml (overwrite : yes)

TeckTP
06-11-2016, 08:22 AM
Ok I try do that.

TeckTP
06-11-2016, 08:29 AM
Works fine :)

Thanks a lot.

TeckTP
06-11-2016, 05:27 PM
One more problem.

Selected as the best answer post sticks to the first post on the page on which he ( the topics where there is more than one page , and the best answer is other than the first page ) . He should stick to the first post in the topic . You can help even in this topic ? I hope you understand me .

emath
06-12-2016, 04:04 AM
One more problem.

Selected as the best answer post sticks to the first post on the page on which he ( the topics where there is more than one page , and the best answer is other than the first page ) . He should stick to the first post in the topic . You can help even in this topic ? I hope you understand me .

fixed, reimport product-voteandanswer.xml
enjoy

TeckTP
06-12-2016, 06:36 AM
Now works ok. Thank you for update.

emath
07-02-2016, 08:41 AM
V1.9

- bug fix, handle deleted posts

Surf_rider
11-25-2016, 09:56 AM
When i press button "Best answer" nothing changes

caciquegm
12-03-2016, 02:12 AM
Hi gus, do you tellme what is the name of the tables that mods creates?

inmart
12-20-2016, 09:50 PM
Is it possible to do to the theme (topic) author chose best answer? in addition to those groups that are specified in the settings

emath
01-01-2017, 09:16 AM
When i press button "Best answer" nothing changes

can you give me link ? (PM is fine)

emath
01-01-2017, 09:19 AM
Hi gus, do you tellme what is the name of the tables that mods creates?

It does not create any new table, only adds a column 'is_best_answer' for the posts table.


Is it possible to do to the theme (topic) author chose best answer? in addition to those groups that are specified in the settings

Yeah, this comes by default, this is how it works.

rnedelkow
06-15-2017, 05:58 PM
Hi, does this mod work on vb5?

emath
06-16-2017, 06:25 AM
Hi, does this mod work on vb5?

probably will not work. never tested, but vb5 infrastructure is totally different .

rnedelkow
06-16-2017, 12:32 PM
@emath, thanks for the reply.