Add-ons
  1. Add-ons
  2. CONTRIB-2022

Problem with the Forum post approval Patch

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.9.8
    • Fix Version/s: None
    • Labels:
      None
    • Database:
      MySQL
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      21892

      Description

      I am using Moodle 1.9.8 latest.

      First i had huge problem with applying the patch at all, anyway somehow i succeeded to apply the patch trough NetBeands but not completely.

      I asked Anthony to send me the Files he already patched, and i uploaded them to my server and everything seemed to work, when i add a new post the Status is Unapproved, when i log in as Admin i change the post to Approve something happens AJAX "loading" icon shows and the background shows red and it shows that the post is Approved.

      When i go to any location on Moodle or log out and log in again, it shows again to Unnapproved, so nothing happens.

      I set the forum to require approvement, and the unapprove button shows, but when i clik to approve, nothing happens it goes back to unnaprove.

      Has anyone got this to work, or has maybe another solution for adding the ability for Admin to approve posts?

      This one is really critical and i should get it running ASAP.

        Activity

        Hide
        Anthony Borrow added a comment -

        Salim - Do you have a simple course that you use for testing? If so, it would help if you could upload the zip file here so that I do not have to recreate my own. I'm going to make some modifications to the patch so that it is more likely to not get messed up as it seems to get confused with the various nested closing parentheses. By adding some comments to those lines; hopefully we will help clarify things. Peace - Anthony

        Show
        Anthony Borrow added a comment - Salim - Do you have a simple course that you use for testing? If so, it would help if you could upload the zip file here so that I do not have to recreate my own. I'm going to make some modifications to the patch so that it is more likely to not get messed up as it seems to get confused with the various nested closing parentheses. By adding some comments to those lines; hopefully we will help clarify things. Peace - Anthony
        Hide
        Anthony Borrow added a comment -

        Salim - I've done a little further testing and can confirm that the AJAX approval is not working. When it turns red, that is an indication of an error. Now I need to track down that error and see what is happening. Peace - Anthony

        Show
        Anthony Borrow added a comment - Salim - I've done a little further testing and can confirm that the AJAX approval is not working. When it turns red, that is an indication of an error. Now I need to track down that error and see what is happening. Peace - Anthony
        Hide
        Anthony Borrow added a comment -

        Salim - There was a missing close parenthesis in rate_ajax.php that was causing the error. I am attaching an updated patch file along with a zip file with the patch applied (if that helps you). Please test and let me know if you have any other troubles. Thanks again for reporting the issue. I think I have taken some steps where the merge was failing as there are multiple levels of conditional statements and I think it was getting confused with all of the close parentheses so I have added comments to replace those lines rather than leaving them in there. Peace - Anthony

        Show
        Anthony Borrow added a comment - Salim - There was a missing close parenthesis in rate_ajax.php that was causing the error. I am attaching an updated patch file along with a zip file with the patch applied (if that helps you). Please test and let me know if you have any other troubles. Thanks again for reporting the issue. I think I have taken some steps where the merge was failing as there are multiple levels of conditional statements and I think it was getting confused with all of the close parentheses so I have added comments to replace those lines rather than leaving them in there. Peace - Anthony
        Hide
        Anthony Borrow added a comment -

        This was not a security issue - ajax approval simply was not working. Peace - Anthony

        Show
        Anthony Borrow added a comment - This was not a security issue - ajax approval simply was not working. Peace - Anthony
        Hide
        Anthony Borrow added a comment -

        Please test the fix and let me know if you have any other problems. Peace - Anthony

        Show
        Anthony Borrow added a comment - Please test the fix and let me know if you have any other problems. Peace - Anthony
        Hide
        Anthony Borrow added a comment -

        p.s. - I also wanted to comment that I changed $discussion to $post->discussion in the call to see if the user can see the post since that function can handle just the discussion id and does not need the entire record.

        Show
        Anthony Borrow added a comment - p.s. - I also wanted to comment that I changed $discussion to $post->discussion in the call to see if the user can see the post since that function can handle just the discussion id and does not need the entire record.
        Hide
        Salim Šabi? added a comment -

        Hello Anthony, i uploaded the files you already patched, now there is no red color, but again when i klick to approv a post it shows to Approve, but when i go to another page or log out or login again it shows Unnaprove.

        But this seems to be interesting, when i login as Admin user and edit any post of other users the status changes to Approve, but if i try to approve a post with the dropdown, nothing happens.

        Show
        Salim Šabi? added a comment - Hello Anthony, i uploaded the files you already patched, now there is no red color, but again when i klick to approv a post it shows to Approve, but when i go to another page or log out or login again it shows Unnaprove. But this seems to be interesting, when i login as Admin user and edit any post of other users the status changes to Approve, but if i try to approve a post with the dropdown, nothing happens.
        Hide
        Anthony Borrow added a comment -

        Salim - I'm unable to reproduce the behavior you are mentioning. I change it via AJAX and it is changed in the database (I'm checking via a refresh using phpmyadmin). In any case, it seems to be a separate issue in so far as the patch should now apply just fine. If you are experiencing issues with it not approving would you mind opening a separate issue for that. Might there be a common site where we could work on this together. I can set one up for us if you would like or if you want email me the url, login name and password of your site. I would be willing to setup a mutually agreeable time when we could connect via skype or IM and see what is happening. Peace - Anthony

        Show
        Anthony Borrow added a comment - Salim - I'm unable to reproduce the behavior you are mentioning. I change it via AJAX and it is changed in the database (I'm checking via a refresh using phpmyadmin). In any case, it seems to be a separate issue in so far as the patch should now apply just fine. If you are experiencing issues with it not approving would you mind opening a separate issue for that. Might there be a common site where we could work on this together. I can set one up for us if you would like or if you want email me the url, login name and password of your site. I would be willing to setup a mutually agreeable time when we could connect via skype or IM and see what is happening. Peace - Anthony
        Hide
        Anthony Borrow added a comment -

        Closing all of my resolved issues. Peace - Anthony

        Show
        Anthony Borrow added a comment - Closing all of my resolved issues. Peace - Anthony

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development