Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Getting error on 2.3

Am getting this error when I enable the plugin Prefix Discussion:

|Gdn_Database|Query|show tables like 'GDN_Permission'

Any chance to fix it?

Comments

  • R_JR_J Ex-Fanboy Munich Admin
    edited February 2017

    PrefixDiscussion even works in 2.4b1 B)

    That snippet you are showing is quite small. Could you show more information of the error message?

  • The addon could not be enabled because it generated a fatal error:
    |Gdn_Database|Query|show tables like 'GDN_Permission'
    @R_J

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited April 2017

    You can fix that by replacing the permissions in the array with these changes

    'RegisterPermissions' => array(
            'Garden.Moderation.Manage',
            'Garden.Settings.Manage',
            'Vanilla.Discussion.Add',
            'Vanilla.Discussion.View'
        ),
    

    Then here

    public function settingsController_prefixDiscussion_create($sender) {
            $sender->permission(array('Garden.Moderation.Manage','Garden.Settings.Manage'));
    

    Then here

     public function postController_beforeBodyInput_handler($sender) {
            // Only show dropdown if permission is set.
            if (!checkPermission('Vanilla.Discussion.Add')) {
                return;
            }
    

    And here

     public function discussionController_beforeDiscussionRender_handler($sender) {
            if (!checkPermission('Vanilla.Discussion.View')) {
                return;
            }
    

    Then here too

    public function base_beforeDiscussionName_handler($sender, $args) {
            if (!checkPermission('Vanilla.Discussion.View')) {
                return;
            }
    

    After that it works for me..

  • R_JR_J Ex-Fanboy Munich Admin

    @lalala said:
    The addon could not be enabled because it generated a fatal error:
    |Gdn_Database|Query|show tables like 'GDN_Permission'
    @R_J

    Thanks for the feedback! I've started investigating this and it is working if you try to enable it a second time, nothing else is needed.

    I see where the error is, but not why that should be an error...

            $fixDone = c('PrefixDiscussion.PrefixMixingFixDone', false);
            if (!$fixDone) {
                Gdn::sql()->update('Discussion', array('Prefix' => null), array('Prefix' => ''));
                saveToConfig('PrefixDiscussion.PrefixMixingFixDone', true);
            }
    

    The update generates that error, but the config value is saved. The next time the plugin is enabled the config value check results in skipping the update statement and that's why the plugin activation is working on the second try.

  • Thank! @R_J and @vrijvlinder

  • R_JR_J Ex-Fanboy Munich Admin

    @lalala Please

    • deactivate the old version
    • completely delete the old version
    • download and unzip the new version
    • if you use memcached, restart the service
    • activate the new plugin

    If you never used prefixDiscussion before and this was the first time that you have tested it, you could stay with the old version. If you are interested, you could take a look at the changed lines and you will see that there only has been a substantial change in the setup process.

Sign In or Register to comment.