New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore a trigger "onKunenaGetTopics" #4645

Merged
merged 4 commits into from Oct 3, 2016

Conversation

Projects
None yet
2 participants
@obsidev
Contributor

obsidev commented Oct 3, 2016

Pull Request for Issue #4643 .

Summary of Changes

Due to the modification in the Kunena core, some files (models) are not used anymore.
In the new core, the trigger "onKunenaGetTopics" is not more called, so the option "Select View: By Plugin" is not working anymore.

That patch will restore a trigger but will rename it in order to not generate side effect due to the modification in the parameters.

Testing Instructions

Create a Kunena menu and select the "By plugin" view mode.
In the header text, put "moderation".

In a plugin, put the trigger:

    public function onKunenaGetUserTopics($pluginmode, &$finder, &$order, &$categoryIds, $controller) {
        if($pluginmode != 'moderation')
            return;

        $finder->filterByHold(array(0,1));

        // Force all categories
        $categoryIds = null;

        $finder
            ->select('a.id')
            ->order('last_post_time', 1)
            ->where('a.first_post_userid', '>', '0');
    }

We removed some code for extra columns used by our moderation system

Restore a trigger "onKunenaGetTopics"
Because the parameters are very different from the trigger "onKunenaGetTopics", the trigger is renamed "onKunenaGetUserTopics".
default :
$finder
->filterByUser($user, 'involved')
->order('favorite', -1, 'ut');
break;
}
$categories = KunenaForumCategoryHelper::getCategories($categoryIds, $reverse, $authorise);
$finder->filterByCategories($categories);
if($categoryIds !== null) {

This comment has been minimized.

@810

810 Oct 3, 2016

Member

please fix codestyle. Add a space after if

This comment has been minimized.

@obsidev

obsidev Oct 3, 2016

Contributor

Sure

@obsidev

This comment has been minimized.

Contributor

obsidev commented Oct 3, 2016

I just remember that, in order to work properly, it also require a modification in the "librairies/kunena/forum/topic/finder.php" so the plugin can have access to the "select".

    public function select($data) {
        $this->query->select($data);
        return $this;
    }
@810

This comment has been minimized.

Member

810 commented Oct 3, 2016

I just remember that, in order to work properly, it also require a modification in the "librairies/kunena/forum/topic/finder.php" so the plugin can have access to the "select".
public function select($data) {
$this->query->select($data);
return $this;
}

Could you also add this on the pr

@810 810 added enhance 5.0 labels Oct 3, 2016

@810 810 added this to the 5.0.3 milestone Oct 3, 2016

obsidev added some commits Oct 3, 2016

Open an access to the query select
The topic finder can now provide a direct access to the query select, so plugins will be able to retrieve more data when using the trigger "onKunenaGetUserTopics"

@810 810 merged commit 46ca256 into Kunena:K5.0 Oct 3, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

810 pushed a commit to 810/Kunena-Forum that referenced this pull request Oct 3, 2016

810 added a commit that referenced this pull request Oct 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment