WordPress.org

Ready to get started?Download WordPress

Forums

BadgeOS
[resolved] Award for a blog post possible? (14 posts)

  1. Martin
    Member
    Posted 1 year ago #

    I've looked through the possibilities but am unable to find how to award one of my users for making a blog post.

    I know of Submissions but they don't really work in this case.
    Obviously, with Approved Contributor posts come number so further badges can be based on that too.

    So for a Contributor who submits a post they have submitted through the normal WP 'Add New' process, how can I do this?

    http://wordpress.org/extend/plugins/badgeos/

  2. Brad Williams
    Member
    Plugin Author

    Posted 1 year ago #

    Currently there is no way to trigger a badge when creating a new blog post in BadgeOS. However you can register your own triggers using the badgeos_activity_triggers filter.

    Here's an untested example:

    add_filter( 'badgeos_activity_triggers', 'my_custom_triggers' );
    
    function my_custom_triggers( $triggers ) {
        $triggers['save_post'] = __( 'Save a post', 'my-plugin' );
        return $triggers;
    }

    The key is the hook you're following, the value is the output in the select box (and log entries… and step title...)

    We're working on some detailed documentation to show code examples for extending BadgeOS. We hope to have that on http://badgeos.org soon

  3. Martin
    Member
    Posted 1 year ago #

    Ahh cool.

    A bit of doco is always good for code newbies such as myself.

    For what I'm after, I'm guessing the hook would be more like publish_post however I don't understand the reference to my-plugin in your example above.

    Great there's this functionality already coded up though. Way cool

  4. Michael Beckwith
    Member
    Plugin Author

    Posted 1 year ago #

    Martin, if you're talking about this part:

    __( 'Save a post', 'my-plugin' );

    then the my-plugin half is just a textdomain for translations. If you don't have that with your need, you could just change that whole line to

    $triggers['save_post'] = 'Save a post';
  5. Martin
    Member
    Posted 1 year ago #

    Ahh cool - thanks for giving me that feedback Michael - really appreciate your help, mate.

    I'll give all this a try out since I'm promoting guest blogging at the moment.

    Thanks again for helping an old newbie out :)

  6. Martin
    Member
    Posted 1 year ago #

    Well, it all seemed to work in adding a new action etc etc - now to see if it triggers :)

    BTW, for anyone else, WordPress' list of Actions that I found is at http://codex.wordpress.org/Plugin_API/Action_Reference

  7. Michael Beckwith
    Member
    Plugin Author

    Posted 1 year ago #

    Another, perhaps more complete and robust hook reference can be found at http://adambrown.info/p/wp_hooks

    For those curious :)

  8. Martin
    Member
    Posted 1 year ago #

    Now you just went and confused the heck out of me, Michael.
    Not sure whether publish_post is the right 'hook' to use in my example of the publication of a post type post or whether it's been deprecated or not.
    Did I get it wrong in using the following to trigger the detection of a published posttype post:

    add_filter( 'badgeos_activity_triggers', 'my_custom_triggers' );
    
    function my_custom_triggers( $triggers ) {
        $triggers['publish_post'] = 'Get a Blog Post published';
        return $triggers;
    }
  9. Michael Beckwith
    Member
    Plugin Author

    Posted 1 year ago #

    publish_post should be fine, I assume you looked and saw this:

    {$new_status}_{$post->post_type}

    which is a dynamic listing, the status is still publish, and post is still a valid, so publish_post would fit the bit above.

    Unless something horribly breaks or you get errors, you're probably safe.

  10. Martin
    Member
    Posted 1 year ago #

    Yeah I did see that hence my confusion because I didn't have a freaking clue what to do with the dynamic listing hahaha

    I saw you work for the fine lads and lassies at do the plugin too so your help on this and other stuff to do with the BadgeOS plugins is mucho appreciated, Michael.

  11. Michael Beckwith
    Member
    Plugin Author

    Posted 1 year ago #

    That I do, chances are you'll see me a lot more on all 3 BadgeOS plugin support forums.

  12. Martin
    Member
    Posted 1 year ago #

    Oh well, seems like my publish_post trigger doesn't work after all :(
    Have had 3 scheduled posts published to 3 different Contributors and none have triggered the Award.
    And to make matters worse, I manually published a Contributor post and the Admin (me) was awarded the Badge - sheesh!

  13. Martin
    Member
    Posted 1 year ago #

    Any ideas what I might have done wrong?

  14. Brad Williams
    Member
    Plugin Author

    Posted 1 year ago #

    BadgeOS v1.1 includes triggers for new blog posts and pages. See the changelog here:
    https://github.com/opencredit/badgeos/blob/master/readme.txt#L177

    More info and beta download:
    http://wordpress.org/support/topic/badgeos-11-beta?replies=1

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.