Sitewide Activity
-
Hi,
I am developing activity widget for my website to show all the available activities on the sidebar. It works fine on all the pages except on members profile page. The problem with the members profile page is that its loading all the activities only from the current member you are viewing.
Please see my code below for filtering activity loop
if ( bp_has_activities( 'type=sitewide&max='.$max_num. '&object=activity,blogs,friends,groups,profile,xprofile &user_id=&primary_id=' ) ) { while ( bp_activities() ) { bp_the_activity();
Thanks in advance.
-
@rameshwormaharjan
Why try to reinvent the wheel? Try this:
If that doesn’t work for you then at least study the code to see where you are going wrong.@bphelp hi I tried your plugin unfortunately it didn’t work for me. On members profile page it shows activities only from current user. I need a widget that shows site wide activities all the time regardless of the current action. I studied your code and learned so many things and able to develop my own simple widget for my project.
@rameshwormaharjan
It is not my code, It belongs to @sbrajesh probably the best BP developers out there so the credit belongs to him. Glad it helped you though!If you look in the implementation bp_has_activities(), you’ll see if no user id is supplied as an argument it will default to the displayed_user id on a member page.
See lines 316 and 382 of bp-activity-template.php
If you’re on a non member page it will show activity relative to the logged in user (line 382).
Try passing the logged in user id as an argument to your bp_has_activities() call, that should override the displayed user default on a member page.
My problem is I don’t want to display user specific activities. it should list all the activities regardless of which page you are on. However I have found the solution. On members profile page it takes scope=only-me parameter by default which forces to load activities from current logged in user. Below is the completed plugin for my project which I uploaded to WordPress.
Cheers!!! and thanks for the help.
https://wordpress.org/plugins/buddypress-activity-sidebar-widget-resubmission/
- The topic ‘Sitewide Activity’ is closed to new replies.