BuddyDev

Search

Replies

  • Participant
    Level: Master
    Posts: 279
    Richard Foley on in reply to: [Resolved] BP AutoLoader loads 7 months ago #20137

    And so quick! 🙂

  • Participant
    Level: Master
    Posts: 279
    Richard Foley on in reply to: [Resolved] BP AutoLoader loads 7 months ago #20136

    hi Brajesh,

    glad to have nudged you into an overdue update (and rewrite) of this very useful little plugin. It works fine and just as expected, many thanks!

    Closing.

    R.

  • Participant
    Level: Master
    Posts: 279

    ps. I’ll still take a look at your more advanced restrictions plugin when you release it, but this has taken the edge off the urgency for the moment. Again, this was a very helpful solution and I really appreciate your helping me with this task, Brajesh. Thank you.

    R.

  • Participant
    Level: Master
    Posts: 279

    hi Brajesh,

    I’m using your code, and it’s working as expected. Very flexible and works well with your plugin. Clearly I need to read up on classes in PHP, I was expecting that to work differently.

    Great job – many thanks again for stepping in!

    R.

  • Participant
    Level: Master
    Posts: 279

    hi Brajesh,

    that looks very helpful, I think my solution was a tad “naive”, yours looks much more complete (and functional…). I’ll look at it tomorrow and be sure to let you know how I get on.

    R.

  • Participant
    Level: Master
    Posts: 279

    hi Brajesh,

    an example using a role, or capability, would be really useful.

    R.

  • Participant
    Level: Master
    Posts: 279

    Looking at this a bit more, I’m thinking I might need to remove and replace your can_post_update() function entirely (via remove_action) and replace it (via add_action) with my own capability logic. Hmmm.

  • Participant
    Level: Master
    Posts: 279

    notes: this seemed to work, or at least the rate-limiter plugin certainly kicked in. However, it appeared to block all users, not just the ones I was after (with the restricted role). It’s possible I may be using the action/call incorrectly?

    R.

  • Participant
    Level: Master
    Posts: 279

    hi Brajesh,

    here’s my question… I currently have this boilerplate, but am unsure how it will mesh with your class. Possibly I need to initialize, or call a global instance, here.

    
    // ignore the $user arg, just ask about the current user.
    function my_restrict_post( $user ) {
    
            // use my capability to block based on the user role
            if ( current_user_can( 'not_post_freely' ) ) {
                    return false; // block the post
            }
    
            return true; // let the user post
    
    }
    add_filter( 'can_post_update', array( 'BP_Rate_Limit_User_Activity_Helper', 'my_restrict_post' ) );
    

    How does this look – advice always welcome…

    R.

  • Participant
    Level: Master
    Posts: 279

    hi Brajesh,

    this is functioning as expected. It took me a while to work out why it wasn’t at first, and it turned out I had another “feature” enabled which rerouted around the request, once I’d found that and fixed it everything behaved correctly.

    I do realize this is somewhat outside your remit of support for your own plugins, so an extra many thanks again for your assistance with this!

    R.