MyBB Community Forums

Full Version: ABP Solve It !
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi Crazycat, love this plugin. However, I seem to have problems getting #3 to work in 1.8.19:
  1. The table abp_solveit_tuning was missing when I tried to save the configuration. To fix this I had to manually create the database
  2. In line 443, have to change the code to:
    my_post_key: '" . $mybb->post_code . "',
However now when I tried to mark as post as read, it returned "This forum does not accept solutions". Traced that to:

    if ($mybb->settings[CN_ABPSOLVEIT . '_forums'] != -1 && !in_array($thread['fid'], $s_forums)) {
        // Not a forum where we can solve, exiting.
        return array('error' => $lang->abp_sierr2);
    }
Any idea why this condition is met? Still trying to decipher what the contents of the two tests are.

Update:
So, it seems $thread is uninitialised above. So I moved two lines of code below the if block and it now looks like this:
    $query = $db->simple_select('threads', '*', "tid=" . $db->escape_string($tid));
    $thread = $db->fetch_array($query);

    if ($mybb->settings[CN_ABPSOLVEIT . '_forums'] != -1 && !in_array($thread['fid'], $s_forums)) {
        // Not a forum where we can solve, exiting.
        return array('error' => $lang->abp_sierr2);
    }

Click on the 'Mark as solution' button... No error, but also, nothing happend... What else am I missing Big Grin ?
(2018-10-14, 01:31 AM)snakeoilos Wrote: [ -> ]Hi Crazycat, love this plugin. However, I seem to have problems getting #3 to work in 1.8.19:
  1. The table abp_solveit_tuning was missing when I tried to save the configuration. To fix this I had to manually create the database
  2. In line 443, have to change the code to:
    my_post_key: '" . $mybb->post_code . "',
Strange, the table is created when you go on the "ABP Solve It!" configuration menu if it doesn't exist.
And the my_post_key variable exists in the headerinclude of mybb, unless you change it.


(2018-10-14, 01:31 AM)snakeoilos Wrote: [ -> ]However now when I tried to mark as post as read, it returned "This forum does not accept solutions". Traced that to:

    if ($mybb->settings[CN_ABPSOLVEIT . '_forums'] != -1 && !in_array($thread['fid'], $s_forums)) {
        // Not a forum where we can solve, exiting.
        return array('error' => $lang->abp_sierr2);
    }
Any idea why this condition is met? Still trying to decipher what the contents of the two tests are.

Update:
So, it seems $thread is uninitialised above. So I moved two lines of code below the if block and it now looks like this:
    $query = $db->simple_select('threads', '*', "tid=" . $db->escape_string($tid));
    $thread = $db->fetch_array($query);

    if ($mybb->settings[CN_ABPSOLVEIT . '_forums'] != -1 && !in_array($thread['fid'], $s_forums)) {
        // Not a forum where we can solve, exiting.
        return array('error' => $lang->abp_sierr2);
    }

Click on the 'Mark as solution' button... No error, but also, nothing happend... What else am I missing Big Grin ?

Woops, you're right, my query is not at the good place, my bad.
I'll correct that tomorrow, I think I was tired when I uploaded this version Smile

Thanx for your comments !
(2018-10-14, 12:13 PM)Crazycat Wrote: [ -> ]Strange, the table is created when you go on the "ABP Solve It!" configuration menu if it doesn't exist.
Yeah, I'm not sure why it didn't work for me either Sad. To get around this I cut & paste the CREATE command, and fill up the $collate entries.

One thing though, I've renamed my ACP folder from 'admin' to something else. The ACP path is hard coded in this plugin. Even though I have changed all of the known paths, maybe there's causing the problem? I think you can programtically find the path of the ACP, probably a good idea to do that?

Also, uninstall/deactivate and re-install doesn't seem to help.


(2018-10-14, 12:13 PM)Crazycat Wrote: [ -> ]And the my_post_key variable exists in the headerinclude of mybb, unless you change it.
I'm using #3. And in that file, line #443 onwards says
			data: {
				plugin: '" . CN_ABPSOLVEIT . "',
				my_post_key: my_post_key,   // <- I changed this 
				type: 'solve',
				tid: " . $mybb->get_input('tid') . ",
				pid: pid
			},


(2018-10-14, 12:13 PM)Crazycat Wrote: [ -> ]Woops, you're right, my query is not at the good place, my bad.
Not a problem at all. It's still a dev build, but already it's working well.. I just need to figure out how why the post I masked as the solution doesn't seem to work upon reload. Don't think the saving part works.

In my forums, when I mark a post as a solution. It automatically prefixed the header, and the solution post turned green. But when I reload the page, the green disappeared.

(2018-10-14, 12:13 PM)Crazycat Wrote: [ -> ]I'll correct that tomorrow, I think I was tired when I uploaded this version Smile

Thanx for your comments !
Thanks for your plugin. This is a very useful feature and I do appreciate your time/effort making this.
(2018-10-14, 11:54 PM)snakeoilos Wrote: [ -> ]In my forums, when I mark a post as a solution. It automatically prefixed the header, and the solution post turned green. But when I reload the page, the green disappeared.

Oh damn ! I didn't upload the good version !
I can't access my good release now, but the trouble is that I forget to add the solve pid in the update array.
Move the start of the comment block from line 531 to line 532, and it will work.
(2018-10-15, 02:11 PM)Crazycat Wrote: [ -> ]Oh damn ! I didn't upload the good version !
I can't access my good release now, but the trouble is that I forget to add the solve pid in the update array.
Move the start of the comment block from line 531 to line 532, and it will work.
Indeed. Now that you mention it, of course Big Grin ..

I moved that line here instead,
    $solver['closed'] = 0;
    $solver['prefix'] = 0;
    $solver = array('solve_pid' => $pid); // moved it to here

Now another question Blush . What happens when one makes a mistake, and wants to 'Unmark this as a solution'.

Don't think this is supported yet.

Possible to add this in a future release? Allow the thread owner, or people in some selectable groups (e.g. moderators) to 'Unmark' a post as the solution. And decrease the solution count when that is done (Don't think this solution count is used anywhere?).
Ok, the build #5 (https://community.mybb.com/mods.php?acti...9&bid=3527) is ok.

I'll soon add the way to unmark a solution, but I'll refactor the plugin because it begins to be awfull, and adding this feature make the system more complex: I've to keep the old state off the thread (prefix and un/close) to restore it when it's marked as unsolved.

And I'll use the solution count in user profiles.
(2018-10-16, 11:46 AM)Crazycat Wrote: [ -> ]Ok, the build #5 (https://community.mybb.com/mods.php?acti...9&bid=3527) is ok.
Great. Will try that and let you know. Smile

(2018-10-16, 11:46 AM)Crazycat Wrote: [ -> ]I'll soon add the way to unmark a solution, but I'll refactor the plugin because it begins to be awfull, and adding this feature make the system more complex: I've to keep the old state off the thread (prefix and un/close) to restore it when it's marked as unsolved.
Good point. Didn't thought of that.


(2018-10-16, 11:46 AM)Crazycat Wrote: [ -> ]And I'll use the solution count in user profiles.
Cool.

Really love this plugin by the way. Funnily enough I don't even know I need something like this before, until I saw this thread. It's one of those "hey why didn't I think of doing this before?" moment... Angel


Edit: Quickly tried #5.. Uninstall #3, update to #5. Install and reactivate.. Setup as before.. Look in my forums, don't see the solution post, or the "Go to Solution" button, or the "Mark as Solution" buttons any more. Not entirely sure what the issue is (I did modify the button URLs to suit my theme)... Will troubleshoot and get back to you later after work.

Edit2: Probably didn't reload the pages properly. It works. Thanks.
I am just waiting to v1.0 will all promised features, fingers crossed
(2018-10-17, 05:35 AM)Eldenroot Wrote: [ -> ]I am just waiting to v1.0 will all promised features, fingers crossed

Can't wait myself.. Already using it now.. So far so good *fingers crossed* + *touch wood*.
Wow ! I found a bug in my plugin, it's now corrected in build #6 - plugin version 0.3.2
The bug was in the xmlhttp and it was blocking all the ajax queries, so people can't register to the forum (username check failed).
Pages: 1 2 3