Created
January 3, 2023 01:13
-
-
Save contemplate/06b3eef9c4c135c63d97048ed0477ea7 to your computer and use it in GitHub Desktop.
Buddyboss Jump to Reply fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // When click on notification then move to particular reply. | |
| moveToReply: function () { | |
| if ( window.location.href.indexOf( '#post-' ) > 0 ) { | |
| var varUrl = window.location.href.split( '#post-' ); | |
| var postID = varUrl && undefined !== varUrl[1] ? varUrl[1] : ''; | |
| if ( !postID ) { | |
| return; | |
| } | |
| var scrollTop; | |
| if ($('#wpadminbar').length){ | |
| //if wpadminbar exists | |
| if ( $( 'body' ).hasClass( 'sticky-header' ) ) { | |
| scrollTop = ( $( '#post-' + postID ).parent().offset().top - $( '#masthead' ).innerHeight() - $( '#wpadminbar' ).innerHeight() ); | |
| } else { | |
| scrollTop = ( $( '#post-' + postID ).parent().offset().top - $( '#wpadminbar' ).innerHeight() ); | |
| } | |
| }else{ | |
| //if wpadminbar doesn't exist | |
| if ( $( 'body' ).hasClass( 'sticky-header' ) ) { | |
| scrollTop = ( $( '#post-' + postID ).parent().offset().top - $( '#masthead' ).innerHeight() ); | |
| } else { | |
| scrollTop = ( $( '#post-' + postID ).parent().offset().top ); | |
| } | |
| } | |
| $( 'html, body' ).animate( { | |
| scrollTop: scrollTop | |
| }, 200 ); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixes Buddyboss Notification Jump links for Forums.
buddyboss-theme/assets/js/plugins/bbp-reply-ajax.js
buddyboss-theme/inc/plugins/bbpress-helper.php
also cache bust the loading by changing the version:
wp_enqueue_script( 'buddyboss-bbpress-reply-ajax', get_template_directory_uri() . '/assets/js/plugins/bbp-reply-ajax' . $minjs . '.js', array( 'jquery' ), buddyboss_theme()->version(), true );