Skip to:
Content
Pages
Categories
Search
Top
Bottom

wire post at the home page…


  • Ali Erkurt
    Participant

    @alierkurt

    hello. i’m using bp 1.1.1 and was testing wire post function. i want to call wire post function to put the wire post form to the home page. but i dont know the function. i tried bp_wire_new_post() but it didnt work. i tried including post-form.php but i occured a posting error for the form’s “action” url.

    how can i put the wire post form to my homepage just like twitter.

    thanks.

    best.

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

  • Brajesh Singh
    Participant

    @sbrajesh

    try this one…

    locate_template( array( '/wire/post-form.php' ), true );

    It should put the form there


    Ali Erkurt
    Participant

    @alierkurt

    yeah i tried putting “include” code either. i can see the form with your code either but when i click the send button i get a 404 “Page Not Found” error. because it cannot render member slug or wire post link. i see the url like that: mysite.com/wire/post that’s the problem. the form’s action doesnt work… i think the problem is with that function: bp_wire_get_action()

    any ideas?


    Ali Erkurt
    Participant

    @alierkurt

    and yeah, due to i’m using this code for the root of the site, it cannot apply filter for the root directory. solution must be here somewhere i guess:

    bp_get_wire_get_action:

    return apply_filters( 'bp_get_wire_get_action', site_url() . '/' . $bp->{$bp->active_components[$bp->current_component]}->slug . '/' . $uri . '/' . $bp->wire->slug . '/post/' );


    Brajesh Singh
    Participant

    @sbrajesh

    hi

    well I got your idea better now.You want something like twitter where a person writes to his her own wall.

    In that case ,there are a few things you can do.

    1.add filter to change the wp_wire_action

    something like this

    function my_bp_wire($wire)

    {

    global $bp;

    if(is_home())

    return get_bloginfo('wpurl');

    else

    return $wire;

    }

    add_filter("bp_get_wire_get_action","my_bp_wire");

    2.Create your own handler for handling the wire post action.here your item of interest will be functions

    bp_wire_new_post

    also, you may like to take a look at bp-xprofile.php and the function xprofile_action_new_wire_post

    to see how the wire posts at handled at profile page.You jaust have to digg a little deep and create a hacked version of the xprofile_action_new_wire_post,as your own function ,so if someone posts at the site’s home page,It is correctly saved as wire post.

    Let me know ,How it goes with you.


    Ali Erkurt
    Participant

    @alierkurt

    thank you sir. i solved the problem by myself by defining a new function :). but your first solution is shorter than mine so thank you again :)

    edit: and there’s a problem with your 1st function. when i click it the form doesnt work.


    Ali Erkurt
    Participant

    @alierkurt

    i’ve created a new function like that:

    function bp_my_custom_wire_post() {

    echo my_custom_wire_post();

    }

    function my_custom_wire_post() {

    global $bp;

    if ( empty( $bp->current_item ) )

    $uri = $bp->current_action;

    else

    $uri = $bp->current_item;

    if ( $bp->current_component == $bp->wire->slug || $bp->current_component == $bp->profile->slug ) {

    return apply_filters( 'my_custom_wire_post', $bp->loggedin_user->domain . $bp->wire->slug . '/post/' );

    }

    }

    and i’ve created a new customized post-form.php for myself. i gave it “mywirepost.php” name. and then i put my locate code to my homepage:

    locate_template( array( '/wire/mywirepost.php' ), true );

    that’s all :). i’ve solved my own problem and that’s way how you learn better :). thank you brajesh for your help.. i appreciate your interest. regards.


    takuya
    Participant

    @takuya

    Great post, this might help people looking to use p2 theme for wires.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘wire post at the home page…’ is closed to new replies.
Skip to toolbar