Skip to:
Content
Pages
Categories
Search
Top
Bottom

BUG?: AJAX output of the Wire on profiles ignores 'post-list.php' template

  • Avatar of Hempsworth
    Hempsworth
    Participant

    @hempsworth

    BP Trunk

    WPMU Trunk

    I have created a custom loop in ‘post-list.php’ for the Wire on profiles etc. It outputs fine, and all works great – until enough posts have been made that it becomes paginated.

    The AJAX built into the Wire component loads the new posts after clicking, but seems to ignore my custom loop in ‘post-list.php’.

    I’m considering this a bug, could anybody shed some light or should I open a trac ticket?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of Hempsworth
    Hempsworth
    Participant

    @hempsworth

    I also have the following Javascript which gives an Ajax effect when deleting wire posts; deletes it in the background and hides that comment:

    jQuery('#wire-block ul li a:contains("[Delete]")').click(function(){
    var deleteURL = jQuery(this).attr('href');
    jQuery.post(deleteURL);
    jQuery(this).parent().parent().fadeOut();
    return false;
    });

    Which works really well, until I move from the wire comments on paginated page 1, to any other. So not only is the built in Ajax from BP ignoring my custom wire loop, it also ignores the Javascript…

    How do I ensure my Javascript works on paginated outputs?

    Avatar of Hempsworth
    Hempsworth
    Participant

    @hempsworth

    Any ideas on this?

    Should I report it as a bug, or is there a way to get around this?

    Avatar of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    Report it as a bug please.

    Hey Hempsworth!

    I’m triyng tp build a component which make wire ajax-ified. In the sense you can post something via Ajax, without reloading the page.

    I achieved to save message in background as you be able to delete it.

    But I have a prob…I’m not able to able to make bp return me the “graphic” instance of the just saved wire post.

    have you some ideas on how to achieve that???

    This is my code used to save the wire:

    function bp_wire_ajax_save_post(){ //todo: set return value

    global $bp;

    //print_r($bp);

    if (is_user_logged_in()){

    $message = $_POST['wire-post-textarea'];

    if($message=='')

    $message='ciaoooooo';

    //save the message

    $postId = bp_wire_new_post($bp->loggedin_user->id, $message, $bp->profile->slug, false, $bp->profile->table_name_wire);

    $args = 'item_id=' . bp_wire_item_id() . '&can_post=' . bp_wire_can_post() ;

    echo $args;

    }

    It work like a charm. Please don’t see some “echo” etc, they are debug info. This is not the final version :P

    Now the difficult one: I use this to retrieve the graphic wire instance from template, but the loop doesn’t work…

    $args ='item_id=' . $_POST['bp_wire_item_id'] . '&can_post=1';

    $args = 'item_id='.$bp->loggedin_user->id.'&component_slug='.$bp->current_component.'&max=1&per_page=1&can_post=' . bp_profile_wire_can_post() ;

    $args = 'item_id=' . bp_wire_item_id() . '&can_post=' . bp_wire_can_post() ;

    echo $args;

    <?php if ( bp_has_wire_posts( $args ) ) : ?>

    //print wire

    but it show me always “no wire to post”

    someone could help me???

    This thread is 2 months old and was originally about another issue. Please start a new thread.

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

You must be logged in to reply to this topic.