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.
Options

Recent Posts by User Role

I've been looking at a few plugins, and trying to figure out how to create a "recent" posts section that would return any posts by certain users (specifically, a Moderator or Administrator role). Think a Dev Tracker like the World of Warcraft forums use.

I'm unsure how to go about this. Can I use "$DiscussionModel->Get"?

Thanks!

Comments

  • Options
    hgtonighthgtonight ∞ · New Moderator
    edited May 2013

    Shameless plug: check out LatestPostList for a working example of gnabbing discussions from the discussion model.

    $DiscussionModel = new DiscussionModel();
    $this->_LatestPosts = $DiscussionModel->Get(0, $Limit, 'all');
    

    The third argument is used to pass sql where clauses. You could modify it to be something like:

    $this->_LatestPosts = $DiscussionModel->Get(0, $Limit, array('all', 'InsertUserID' => 2));
    

    This will return up to $Limit discussions started by user 2.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    Yea, was what I was looking at originally. That works wonders, but then I need to filter it down by a specific role, and I wasn't seeing anything in there for that.

  • Options
    peregrineperegrine MVP
    edited May 2013

    use a conditional to check the role.

    you can check various plugins to see how to select via role. cleanser, role signatures, etc.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    @kejek I updated my previous post.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    Interesting. So looking at the database side, I'd have to find a way to add a query statement that filters by roleID of 16 or 32 (admins and moderators). Getting closer, at least now I have an idea of a path to figure this out.

    Thanks!

  • Options

    Awesome, thank you very much!

    Last question - is there any sort of call like DiscussionModel() for comments?

    Or at least a really good resource so I could figure these things? :D

    Thanks again, its really helped me get this going!

  • Options

    Whoops, i found it! Thanks much for all your help guys!

    CommentModel($userid, $limit, 0) works!

  • Options
    hgtonighthgtonight ∞ · New Moderator

    No problem, Welcome to the community!

    Be sure to 'react' to posts you find valuable. (Off-topic, insightful, awesome, lol, etc.).

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    how bout a promote. nice job.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    @peregrine I don't know what I am supposed to use that for.

    I am afraid to click it :D

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    Be sure to 'react' to posts you find valuable. (Off-topic, insightful, awesome, lol, etc.).

    I used to think "not reading documentation was the number one thing that is neglected by new members". But I could be wrong it is clicking on the reaction buttons to give us points. Remember every point is worth bonus dollars when trading them in for valuable gifts in the vanilla forum gift catalog.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited May 2013

    @hgtonight
    @peregrine I don't know what I am supposed to use that for.

    I gave you the promote! I wasn't asking for one - it puts the discussion in the "Best of" under categories.

    But if it was tongue in cheek - why new users can't click on insightfuls - if was lol but not funny.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    @peregrine said:
    I used to think "not reading documentation was the number one thing that is neglected by new members". But I could be wrong it is clicking on the reaction buttons to give us points.

    If you are talking about my signature, I like the way the whitespace looks in it right now. :D

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.