[Support request] BuddyPress custom js code into GP?

Home Forums Support [Support request] BuddyPress custom js code into GP?

Home Forums Support BuddyPress custom js code into GP?

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #1211042
    Carsten

    Hi there, I’m taking up this old topic since it’s relevant to me again

    I was advised to use a hook to add this js

    <script type="text/javascript">
      jQuery(document).ready(function() {
    
    jQuery(‘#send_message_form’).submit( function() {
    jQuery(‘#subject’).val(“Some message subject”);
    });
     });
    </script>
    

    But how can I add this hook with GP, the only place for hooks I know is in an element

    Regards
    Carsten

    #1211074
    Leo
    Staff
    Customer Support

    Try adding that in wp_footer hook in hooks element.

    #1211218
    Carsten

    Hi, sorry, this is not working, would you please check the script syntax for me?

    This is a js for BP, please explain how a script added to the WP_footer can influence BP content?

    Should Execute PHP be marked?

    #1211225
    Leo
    Staff
    Customer Support

    Maybe the wrong quotation marks?

    <script type="text/javascript">
      jQuery(document).ready(function() {
    
    jQuery('#send_message_form').submit( function() {
    jQuery('#subject').val("Some message subject");
    });
     });
    </script>

    Unfortunately I’m not sure what the code is supposed to do – this is something you will need to check with BP’s support.

    wp_footer is a WordPress hook and usually is the place to add custom js code.

    Execute PHP does not need to be checked.

    #1211244
    Carsten

    The code is supposed to fill out a default Subject to a message.

    This is the message I got from BP support, when I raised the question a while back.

    You can put that in your theme’s javascript file. Look for js file in your theme.

    Since it is just 2 lines of code, My suggestion will be to put it in one of the js file provided by theme. Look for a file named buddypress.js and you can put the code inside the dom ready section there. If you are using a custom theme, you may ask there(or check their documents) to see if there is any custom js file supported.

    #1211252
    Leo
    Staff
    Customer Support

    Definitely wouldn’t suggest adding that to the theme’s file as it will be erased during updates.

    Can you check with them to see if it can be added using wp_footer hook?

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.