Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating posts of a custom post type and awarding achievements

  • Avatar of sdls
    sdls
    Member

    @simon_said

    Hey there BP forumns and Paul!

    Question on creating custom post types and tying it in with achievements

    My scenario….

    User are creating posts on the front-end of the website. This is achieved using custom templates and the `wp_insert_post( $args );` function. These posts are being created as custom post types. The custom post type is set up properly in the themes functions files.

    These posts are flagged as ‘pending’ or ‘published’ based on the users total achivements points. If the post is set to ‘pending’ administration has a chance to review the new post and set to approve.

    An achievement has been setup based on the “event” “the user published a post or page”. Ready and waiting for this event to occur. However the event is not triggering as the publishing process has been moved out of the wp-admin/ area.

    My goal is to setup an achievement for users creating this custom post type on the front-end.

    Any ideas on how to achieve this?

    P.S.Love the new 2.1… allowed me to move several of my sites to BP 1.5

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of sdls
    sdls
    Member

    @simon_said

    To try and follow the proper etiquette with the achivements plug-in I have setup a new achievements action in the DB and added in the following function

    `
    // CREATE NEW POST
    function dpa_handle_action_gt_post_user_created_post() {
    $func_get_args = func_get_args();
    dpa_handle_action( ‘gt_post_user_created_post’, $func_get_args );
    }

    function gt_post_set_action_category_name( $category_name, $category ) {
    if ( __( ‘Other’, ‘dpa’ ) == $category_name && ‘gt_post’ == $category )
    return __( “Custom Post Type Creation”, ‘gt-post’ );
    else
    return $category_name;
    }
    add_filter( ‘dpa_get_addedit_action_descriptions_category_name’, ‘gt_post_set_action_category_name’, 10, 2 );
    `
    So know I have the a hook to an imaginary action “gt_post_user_created_post”

    Any thoughts on how to add make this action “gt_post_user_created_post” trigger when the user completes the custom post type form I’ve created on the front-end?

    Avatar of sdls
    sdls
    Member

    @simon_said

    Im not sure if I should delete this whole support post… conversation with myself ;-) …maybe this will me useful to someone else.

    just need to register “DO” the action in the write post function

    `
    // do the action that awards the point
    do_action(“gt_seed_user_created_post”, $NewPostID);
    `

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

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