Create product, add to BuddyPress activity – MarketPress

Is there an option to publish a BuddyPress activity when a user creates a product or any other MarketPress actions?

Thanks!

  • aecnu
    • WP Unicorn

    Greetings maxaud,

    Thanks for bringing this up, it certainly sounds like a useful customization to the plugin.

    Unfortunately, it is not currently available – but we would love to put it into consideration for future development

    I have moved this ticket to the applicable feature requests area and I have alerted the lead developer to the request.

    It might take a bit longer than useful but alternatively, you could see if there’s a developer available at wpmu jobs who could get onto it right this minute

    Thank you for being a WPMU DEV Community Member!

    Cheers, Joe

  • maxaud
    • The Crimson Coder

    Well, I know the code to add activities but I was curious if it did it out of the box.

    For the developers, something like this added to when a user creates and updates a product would be a good place to start:

    // user info
    $user_id = '<userid>';
    $user_display_name = '<userdisplayname>';

    // blog info
    $url = '<link to MP product>';
    $blog_name = '<blogname>';

    // product info
    $product_image = '<productimage>';
    $product_title = '<producttitle>';

    // set arguments
    $args = array(
    'action' => $user_display_name . ' added a new product to their store <a href="' . $url . '" title="' . $blog_name . '">' . $blog_name . '</a>.',
    'content' => '<img src="' . $product_image . '" alt="' . $product_title . '" /><span class="mp_product_acitivity_name">' . $product_title . '</span>',
    'user_id' => $user_id,
    'component' => 'blogs',
    'type' => 'new_blog_post',
    'primary_link' => $url
    );

    // if we have a previous activity ID, we need to update the original
    // ca use when updating a product, suggest storing as a meta value for the product so it can be brought back up in activity when updated.
    if ( !empty( $prev_activity_id ) ) {
    $args['id'] = $prev_activity_id;
    }

    // add activity to database
    $activity_id = bp_activity_add( $args );

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.