Skip to:
Content
Pages
Categories
Search
Top
Bottom

Post Field on Friends Pages


  • Nick Watson
    Participant

    @nickbwatson

    So basically I’ve come up with a very simple way for users to post on other users ‘walls’ without needed to go all the way back to their profile to do the @mention thing.

    It’s nothing spectacular right now because it’s still using @mention I just need some help with it.

    So what I have now is when you go to a friend or another users page, it’s displaying the “whats new” form with predefined text of

    @<?php bp_displayed_user_username() ?>

    This way when a user wants to post something to another user they can just simply go to their page, and type it there.

    The MAIN issue I would like to solve is this:

    What if a user goes to the page, and deletes the predefined text (the @username)? Is there anyway I can hide the @username from the user, so that when they go to post int he form, they just see a textarea and they post what they want to say, and then when they press submit the hidden @username will be added to the front of their post?

    Thank you.

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

  • Nick Watson
    Participant

    @nickbwatson

    Any help at all? Here’s what I have:

    <textarea name="whats-new" id="whats-new" value="" />@<?php bp_displayed_user_username() ?> </textarea>

    So all that I would like do do is hide the

    @<?php bp_displayed_user_username() ?> from the user


    Nick Watson
    Participant

    @nickbwatson

    Solved!

    <script language="javascript" type="text/javascript">
    function addtext(text) {
    document.whatsnewform.whatsnew.value = (text+=document.whatsnewform.whatsnew.value);
    }
    </script>

    I did have to change the names of the forms for this to work because they contained “-” marks (ex whats-new-form).

    But basically you just have that script above your form, and then within the submit button of the form, just add:

    onclick="addtext('@<?php bp_displayed_user_username() ?> ');

    MAKE SURE THERE IS A SPACE AT THE END OF <?php bp_displayed_user_username() ?>

    or else it won’t work when you post.

    Now all I need to do is get it so that when you post, it doesn’t change your personal status!!!


    dre1080
    Member

    @dre1080

    thats great.. would you know how to get when a user types in ‘@’ then a letter, in the whats new textarea??

    for example if i type:

    @N

    which is hinting that i want to mention someone, so that i can display a message like “Mentioning @N…”

    and then once i put a space or type in a comma after @N like “@N,” the message then disappears

    similar to what twitter does on its “whats happening?” textarea


    Nick Watson
    Participant

    @nickbwatson

    Hmm, I’m not sure sorry. I’ll have a look and see if I can do something, I’m pretty new to all this stuff.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Post Field on Friends Pages’ is closed to new replies.
Skip to toolbar