Skip to:
Content
Pages
Categories
Search
Top
Bottom

Posting image with every activity?

  • Avatar of chinesedom
    chinesedom
    Member

    @chinesedom

    Hey guys,

    I want to create an extra field for each activity update. Each activity shall have a URL to a picture.
    How do i tell buddypress to send an extra field to the DB?
    The DB: http://s14.directupload.net/file/d/2919/lkdfjytf_png.htm
    the image url textfield http://s14.directupload.net/file/d/2919/2k2j9p4b_png.htm

    Thats what I found so far:
    global.js, line 66:
    `jq.post( ajaxurl, {
    action: ‘post_update’,
    ‘cookie’: encodeURIComponent(document.cookie),
    ‘_wpnonce_post_update’: jq(“input#_wpnonce_post_update”).val(),
    ‘content’: content,
    ‘object’: object,
    ‘item_id’: item_id,
    ‘imgurl’: imgurl /*added by me*/
    },`
    Obviously jquery is sending some stuff to “ajaxurl”. But what is that url?

    Then I found ajax.php, line 177:
    ` if ( empty( $_POST ) && bp_is_active( ‘activity’ ) ) {
    $activity_id = bp_activity_post_update( array( ‘content’ => $_POST ) );

    } elseif ( $_POST == ‘groups’ ) {
    if ( !empty( $_POST ) && bp_is_active( ‘groups’ ) )
    $activity_id = groups_post_update( array( ‘content’ => $_POST, ‘group_id’ => $_POST ) );

    } else {
    $activity_id = apply_filters( ‘bp_activity_custom_update’, $_POST, $_POST, $_POST );
    }`
    It could be, that this is where “ajaxurl” is sending the values to… But then where is the function “bp_activity_custom_update”?

    Then I found bp-activity-function.php, line 595:
    ` // Meta key does not exist so INSERT
    if ( empty( $cur ) )
    $wpdb->query( $wpdb->prepare( “INSERT INTO {$bp->activity->table_name_meta} ( activity_id, meta_key, meta_value ) VALUES ( %d, %s, %s )”, $activity_id, $meta_key, $meta_value ) );`
    but this is under the function “bp_activity_update_meta”. But shouldn it be “bp_activity_post_update”?

    So my goal is this: when posting an activity update, I want to send an imageurl to the db along with the activity content.

    I really dont get how buddypress is inserting into the DB….

You must be logged in to reply to this topic.