Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Bug Report] Achievements not firing for network subsite actions

  • Avatar of stwc
    stwc
    Participant

    @stwc

    Thanks again for the splendid plugin.

    A fairly major bug to report — achievements are unlocking fine for events based on the main site where BP is installed, but for the network subsite (there is only one on the site in question), events are not unlocking achievements for core actions like posting threads and comments (or any others).

Viewing 12 replies - 1 through 12 (of 12 total)
  • Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    It should work. Am on holiday so have limited time to look at the code for a while.

    What action specifically? Just the ones you mention above? What version of WP and BP?

    Avatar of stwc
    stwc
    Participant

    @stwc

    Not terribly urgent — just reporting what my users are saying. I think (thinking about it) the only events I’m awarding achievements for are posts and comments on the subsite — neither seem to be registering.

    WP 3.0.5 and BP 1.2.7, Achievements 2.0.5. I’m going to try going to WP 3.1 and BP 1.2.8 on my localhost in the next day or two, and if nothing seems broken, roll the updates on to the live server soon…

    Some users are also reporting the notifications still not going away for Achievements, too, so it looks like that one might not be totally licked. It’s just an occasional thing, though, which makes it a headscratcher.

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    Alright, thanks. I am on holiday at the moment but will keep this in mind.

    Avatar of slprof
    slprof
    Participant

    @slprof

    Yep. I can concur. Not working. I unlocked 5 blog posts but other people can’t on their blogs. I have to give it to them manually for now.

    Avatar of stwc
    stwc
    Participant

    @stwc

    Just bumping this (no subsite unlocks) post 2.0.7 release… were you able to reproduce it at all, Paul?

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    Didn’t have time to check them all, to be honest. I plan rolling updates/fixes for Achievements for each weekend, so I’ll test them all next weekend and fix as necessary.

    Avatar of stwc
    stwc
    Participant

    @stwc

    @DJPaul I’m an idiot — I finally found time to look into this a bit more, and I left out some very important information. Sorry if you’ve already wasted time looking at this.

    A couple of things — making posts to either the main site or the subsite does not trigger achievement count incrementing, but I left out something important: the site is a group blog thing where members post from the front end, using Gravity Forms. There is no access to the backend for anyone but superadmins.

    Other plugins — Twitter tools, for example — pick up new posts fine, so what I’m guessing here is the posting event that Achievements is looking at might be one that is somehow earlier in the process of posting to the blog, or one that’s not fired when posting via the front end (of either of the sites) using Gravity.

    I realize this is an edge case, and I’ll try and see if I can track it down myself, but in the service of better generalization, it might be worth your time…

    That said, I believe comments — handled normally through WP — are not being counted by Achievements, though, on the subsite, which would be a bug for a ‘core’ use case.

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    Thanks for the info. I didn’t get time to look this last weekend, as it was the end of first week at my new job, so hope people understand that. I spent a bunch of time getting more fixes done for BP 1.3, too.

    Quite possibly gravity forms posting misses or doesn’t use whichever event Achievements looks for. I don’t own gravity forms so can’t look at it or any documentation that they may have on their site, but I’ll definitely check the counting this week, as that’s pretty major

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    Gravity forms support in general is quite an interesting idea, though that would probably wait for the 2.1+ release, assuming I get a copy of gravity forms, otherwise 2.1 will never get done :)

    Avatar of stwc
    stwc
    Participant

    @stwc

    @DJPaul I’ve done a little more research. Posting something through the WP backend triggered achievements on subsites OK, so it’s not a problem with Achievements per se. It works fine incrementing when a page or post is created from the backend. But my users post from the frontend. ;-)

    So on my testbed I tried using a custom page template to let logged-in users make a new post (rather than using Gravity), and encountered the same problem. I dug into achievements-core.php and found where you’re doing dpa_handle_action_draft_to_publish() and dpa_handle_action_pending_to_publish(). This is leveraging post status transitions for action trigger, I guess — per this — and using either Gravity forms or my custom page template doesn’t fire those actions, it seems. Or at least that’s my surmise.

    So, I’m wondering if you’d have the time to advise what the best way to extend Achievements to cover this would be. I figure I could maybe:

    1) create a new dpa_handle_action_draft_to_publish() analogue that would hook into the Gravity form action for form submit, maybe. No idea how or where would be the best way, especially to do it in a way that wouldn’t be destroyed by Achievement version updates

    or

    2) Modify my regular old page template solution to trigger the status transition you’re looking for in achievements-core.

    I don’t expect you to write the code for me (though that would be nice!) — but if you have any thoughts (given my pretty clunky but mostly-adequate php skills) or pointers, that would be very much appreciated!

    (The site in question is gamefilter.net in case you want to have a look.)

    Avatar of stwc
    stwc
    Participant

    @stwc

    For what it’s worth, and for people looking at something similar in future, I think I’ve solved it.

    I’ve set the Gravity Form to create a post in Draft status, then hooked an action to it to change the status to published after submission. This lets Achievements pick up the draft-to-published status transition properly.

    Here’s the functions.php code I used.

    `add_action(“gform_post_submission”, “change_to_publish”, 10, 2);
    function change_to_publish($entry, $form){

    //getting post
    $post = get_post($entry["post_id"]);

    //changing post status
    $post->post_status = “publish”;

    //updating post
    wp_update_post($post);
    }`

    Ah hah, well done. Yes, I think your solution is the approach I’d take and it looks to be robust enough. Thanks for sticking through this issue :)

Viewing 12 replies - 1 through 12 (of 12 total)

The forum ‘Achievements’ is closed to new topics and replies.