Skip to:
Content
Pages
Categories
Search
Top
Bottom

Toggle #whats-new-form Like Facebook 'Update Status' Link


  • danbrellis
    Participant

    @danbrellis

    Just like on facebook now, how the textarea to update your status is hidden until you click the link ‘Update Status’, I want to do this for my whats-new-form on the activity stream & group home pages. Can anyone offer some help? I’ve tried a few methods, but keep seeming to get caught up with the jquery.

    Once, I got it to work in IE, but not in chrome (odd) with this code:

    bp-custom.php file:

    
    <?php
    function toggle_activity_form () { ?>
    
    <!--
    function toggle_visibility(id) {
    var e = document.getElementById(id);
    if(e.style.display == 'block')
    e.style.display = 'none';
    else
    e.style.display = 'block';
    }
    //-->
    
    <a href="#">Update Status</a>
    <?php }
    add_action ('bp_before_directory_activity_content', 'toggle_activity_form ');
    add_action ('bp_before_group_activity_post_form','toggle_activity_form ');
    

    But, again, I couldn’t get this working in Chrome. Plus, I think I’d prefer jquery in case someone has javascript turned off.

    I really appreciate anyone’s help. I’m approaching a deadline!

    Thanks

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

  • danbrellis
    Participant

    @danbrellis

    bump?


    meg@info
    Participant

    @megainfo

    This code work for me in all browser’s

    Code:
    <?php
    function toggle_activity_form() {
    ?>
    <script type="text/javascript">
    function toggle_visibility(id) {
    var obj = jq("#" + id);
    if(obj.is(":hidden"))
    obj.show();
    else
    obj.hide();
    }
    </script>
    <a href="#" onclick="toggle_visibility(‘whats-new-form’);">Update Status</a>
    <?php
    }
    add_action (‘bp_before_directory_activity_content’, ‘toggle_activity_form’);
    add_action (‘bp_before_group_activity_post_form’,’toggle_activity_form’);

    Hope this help u


    danbrellis
    Participant

    @danbrellis

    Brilliant! This worked perfectly. Thanks very much :)


    meg@info
    Participant

    @megainfo

    u welcome :)

    @megainfo, @danbrellis, please can you explain which file i need to put the above code

    regards


    meg@info
    Participant

    @megainfo

    functions.php or bp-custom.php of your buddypress theme


    mrjarbenne
    Participant

    @mrjarbenne

    functions.php lives in your theme folder, but bp-custom.php is a file you may have (or may need to create) within your wp-contents/plugins folder; it is not part of your theme.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Toggle #whats-new-form Like Facebook 'Update Status' Link’ is closed to new replies.
Skip to toolbar