use this:
if ( !function_exists( 'bp_core_get_notifications_for_user' ) ) {
require_once '/wp-content/plugins/buddypress/bp-core/deprecated/1.9.php';
}
function cg_current_user_notification_count() {
$notifications = bp_core_get_notifications_for_user(bp_loggedin_user_id(), 'object');
$count = !empty($notifications) ? count($notifications) : 0;
echo $count;}
Related Posts:
- How to change the case of all post titles to “Title Case”
- Function to execute when a post is moved to trash .
- Changing the post date and time with function
- Get current post id in functions.php
- Dynamically add id to heading tags
- Fatal error: Call to undefined function post_exists()
- How to publish a post with empty title and empty content?
- How to call function within a page/post, to dynamically generate content?
- How do I use element instead of tags in WordPress post content having webP support?
- Code to auto expire posts after 30 days
- Keep a fluid max number of posts on site
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Custom colors for post rows based on post meta value
- How to add an admin function only to posts, not pages?
- Human Time Diff, change mins to minutes
- How to get new post URL?
- Custom wp_trim_words() function not trimming right
- How to Display Post View Count
- Remove double space after a period
- Delete Post From Front-End and attachment permanently
- Limit function to specific post category
- $post object is null
- How to get a nofication when post submitted
- When paginating a Page with the tag, how can the 2nd and subsequent page styles be customised?
- Function to show random posts from a category
- How to change the page break URL from ../post/2 to …/post/page2/
- Hiding posts in a list from specified categories
- Run a function when post is deleted?
- Checking is user author of number of posts?
- Create cron job without a plugin?
- Buddypress activity id
- How to rename “Publish” metabox title in post screen
- Uppercase first sentence in every post
- Add icon/badge next to posttitle of specific category
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Exclude category from
- Force the “Choose from the most used tags” meta box section to always be expanded
- Show the content that is after the excerpt using child theme
- How to allow users to post only in certain category and hide elements from edit page?
- Is there a way to notify specific users when new posts are published to specific pages?
- How do I display some posts fully on the homepage, and some as an excerpt only?
- Send post id through ajax and get the post content back
- Force authors to Preview a post before publishing
- Order posts alphabetically: how to set order=asc in mysql query?
- Change all author links in Blog roll
- Format latest/newest post differently
- is_page Funtion for Posts ?
- Post type no single page
- Adding a user’s ID behind the tag ref link address
- How to only publish posts with image in it
- Display password protected posts to logged in users
- Isn’t the way posts are displayed very unefficient?
- Summary of Posts by an User
- How to check in functions.php if there is data in a WP_Query?
- restrict incrementation of post vies count when refreshing the page
- Using system date format
- Get post by tag
- Related Posts function not working
- the_content() Not Grabbing All Content
- Query function not executed between element [closed]
- saving/reading custom field value does not work – no value gets POSTed
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Have h2 tag not show up if there are no blog posts
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- How to implement a WordPress comments function?
- How to add content above footer in posts from specific category
- shortcode // get posts by ids
- How to put the author of the post in the comments?
- Check if almost 10 year old – working code is up to date
- Find most used words in post titles
- $post->post_content empty while all other properties are correct
- How to add a custom class attribute into code wrapper? [duplicate]
- Remove pagination if search returns empty
- Remove HTML tags from all posts
- Save All Post Permalink From A Specific Category into a .txt file
- AJAX load more posts not using correct category and repeating the same few posts
- How to Display Most View Post in the template file?
- filter buddypress users posts by user ‘xprofile’ custom fields
- Show post excerpt
- How do I apply a wordpress function to something with no ID inside an archive page?
- Show author bio box
- How to correctly escape data
- Display author bio box
- Check if user has avatar
- Call image from post on index page?
- How do I get thumbnails?
- Run function after post is updated
- When Author add new post change default status to pending
- fire action when post is being edited as well as saved?
- Getting rid of the blog page entirely
- List direct children of page
- Notify Author of the post if admin deletes his post and perform some function
- Display a custom field rating system in the front end
- Ajax calls in wordpress
- Look for one plugin which could send notification to any email when post publish
- Show Next/Previous without Link
- How to automatically convert a form with HTML link into post
- How can I locate the single buddypress forum post template? [closed]
- Filters do not work when there are multiple (one works)
- How to use shortcode to get the second to newest post?