Skip to:
Content

BuddyPress.org

Changeset 2552


Ignore:
Timestamp:
02/03/2010 12:12:19 AM (17 years ago)
Author:
apeatling
Message:

Fixes #1708 - more extensible posting.

Location:
trunk/bp-themes/bp-default
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r2544 r2552  
    6969        }
    7070
    71         if ( (int)$_POST['group'] ) {
    72                 $activity_id = groups_post_update( array(
    73                         'content' => $_POST['content'],
    74                         'group_id' => $_POST['group']
    75                 ));
    76         } else {
     71        if ( empty( $_POST['object'] ) ) {
    7772                $activity_id = bp_activity_post_update( array(
    7873                        'content' => $_POST['content']
    7974                ));
     75        } elseif ( $_POST['object'] == 'groups' ) {
     76                if ( !empty( $_POST['item_id'] ) ) {
     77                $activity_id = groups_post_update( array(
     78                        'content' => $_POST['content'],
     79                                'group_id' => $_POST['item_id']
     80                ));
     81                }
     82        } else {
     83                $activity_id = apply_filters( 'bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content'] );
    8084        }
    8185
  • trunk/bp-themes/bp-default/_inc/global.js

    r2546 r2552  
    5555                button.attr('disabled','disabled');
    5656
     57                /* Default POST values */
     58                var object = '';
     59                var item_id = j("#whats-new-post-in").val();
     60                var content = j("textarea#whats-new").val();
     61
     62                /* Set object for non-profile posts */
     63                if ( item_id > 0 ) {
     64                        object = j("#whats-new-post-object").val();
     65                }
     66
    5767                j.post( ajaxurl, {
    5868                        action: 'post_update',
    5969                        'cookie': encodeURIComponent(document.cookie),
    6070                        '_wpnonce_post_update': j("input#_wpnonce_post_update").val(),
    61                         'content': j("textarea#whats-new").val(),
    62                         'group': j("#whats-new-post-in").val()
     71                        'content': content,
     72                        'object': object,
     73                        'item_id': item_id
    6374                },
    6475                function(response)
  • trunk/bp-themes/bp-default/activity/post-form.php

    r2474 r2552  
    4646                                        </select>
    4747                                </div>
     48                                <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />
    4849                        <?php elseif ( bp_is_group_home() ) : ?>
     50                                <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />
    4951                                <input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id() ?>" />
    5052                        <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.