There’s a couple different things happening here.
First, because you’re hardcoding the additional parameters directly in the template, they apply to everywhere in your theme where you show activity. You might consider either switching it to a filter of `bp_ajax_querystring`, so that you can put some logic into the function (eg, `if ( bp_is_current_action( ‘friends’ ) ) // do this; else // do this;`), or doing that logic right in the template:
`$params = ”;
if ( ! is_super_admin() ) {
$params .= ‘&scope=friends’;
}
?>
`
@boonebgorges
Ok here is what I put in the template:
` $params = ”;
if ( ! is_super_admin() ) {
$params .= ‘&scope=friends&per_page=5’;
}
?>
`
Works almost perfect except for when I attempted passing the second parameter &per_page=5.
On normal users the above code does limit site wide activity to a friends only activity stream and loads only 5 items which is what I want. When I am on the admin account it does show me all activities which is perfect, but for some reason the second parameter &per_page=5 reverts back to displaying 20 activity items. I would still like to also limit the admin to 5 activity items just to help the activity load a little faster. Thanks a lot Boone for what you do, and your help so far!
@boonebgorges
I guess what I am asking is did I pass the 2nd parameter of &per_page=5 wrong? I just want the same behavior with the exception that I want all users including admin to only get 5 items in activity with the load more option below the 5 loaded activities. If I am missing something I would appreciate the help.
I really think this is an important thread, with the impending release of BP 1.6 it would help for developing child themes for BP with more control over activity privacy in conjunction with the profile privacy visibility features in BP 1.6. Thanks Boone!
`if ( is_super_admin() )
$params .= ‘&per_page=5’;
else
$params .= ‘&scope=friends&per_page=5’;
`
I am trying to pass 2 parameters to the user on the if/else statement as the below code shows. The main issue is the else. It loads only 5 items per page as it should, but the &scope=friends is not filtering the activity to show only friends activity for non-admins. Please tell me what I am doing wrong here! Thank you.
`<?php
$params = ”;
if ( ! is_admin() )
$params .= ‘&per_page=5’;
else
$params .= ‘&scope=friends&per_page=5’;
?>
`
Simple, and already answered – flip the if/else actions or remove the false operator like so
`if ( is_super_admin() )
$params .= ‘&per_page=5’;
else
$params .= ‘&scope=friends&per_page=5’;`
If this is still confusing – read up on if/else and what the ! operator does – it means false.
Does anyone know how I can do this? It doesn’t seem like it should be that hard to do. Maybe I am missing something in the syntax or something. Please help. Thank you!
That does limit activity to friends only and limits items loaded to 5 but it doesn’t show show your own activity updates after you refresh the page Shane. The users want to see their own activity updates as well, so the issue isn’t fixed yet. Any help would be appreciated!