Forum Replies Created
-
Oh really? So why is the happening when posting blog comments? Anyway, I will follow your suggestion – thanks. 🙂
Thanks danbp, that looks very useful.
Ah I see, I think I’ve got it now – thanks Henry!
Thanks Henry.
I actually had worked out that function by going through some BuddyPress code, but it’s the first part that’s holding me up. Exactly how do I use preg_replace or filter_var to extract the comment ID?
It strikes me that preg_replace could be used to simply remove the comment ID from the post URL, which may be an even simple way of doing it, but once again I don’t know how to implement this.
Thanks danbp. That’s a potentially very useful piece of code for a site-wide mod in bp-custom.php, but it still isn’t what I’m after. I need to modify a plug-in so that specific functions are restricted to either groups or mentions scopes. So I need a short snippet of code like what I posted above (which restricts the function to activity comments and updates).
This isn’t the kind of thing I’m looking for. What I want is just a simple way of calling a scope in the context of a function – it’s the basic stuff like this that every plug-in developer knows, but which is difficult for normal users to figure out. For example, I’ve figured out how to do it with activity types as follows:
in_array( $activity->type, array( 'activity_comment', 'activity_update' ) )
But how do I do it with scopes?
Unfortunately none of these are quite what I’m after – the following code comes close, but I don’t want a login redirect – just a standard redirect from /members/%username%/activity/mentions/ to /members/%username%/activity/. How can I modify this code to achieve my desired outcome?
function jessicana_redirect_page( $redirect_to, $request, $user ) { $redirect_to = bp_core_get_user_domain($user->ID) . 'notifications/'; return $redirect_to; } add_filter('login_redirect', 'jessicana_redirect_page', 11, 3);
Thanks for the quick response! I’ll look into your suggestions tomorrow.
Hi danbp,
Okay, I found the first function didn’t work, but while I was messing around with it, I found there was a much easier way to do it:
$bp->bp_nav['friends']['name'] = 'Friends';
This is enough to kill the count.
The second function did work – thanks!
OKay, I guess I need to explain more about my situation.
I have only one group which is completely hidden from users on the front end. I set it up because I needed a way of separating activity posted to this group from the rest of the activity stream. However, I don’t want my members to have to grapple with the group interface – I will add the posters I want to use it, and from their point of view, I want it to be just like posting any other activity on the site activity page. So for this purpose, I want to set up a site activity page where the activity stream is restricted to posts from this group only. I want the posting form in this activity stream page to post directly to the group.
Wow, fantastic response danbp!
It’s 2:30AM here now so I’ll have to try this tomorrow, but thankyou so much for your help anyway – that’s quite a lot of code to come up with!
Now all I have to do is figure out this one: https://buddypress.org/support/topic/post-group-update-directly-in-activity-stream-page/
Okay, I tried your suggestion, and it worked perfectly. Thank you so much for your help!
Ah, I see. I did try just putting the bare remove_action in bp-custom.php, but as you say that didn’t work either. I’ll try it in the theme functions.php.
BTW, why is it that some things only work in the theme’s functions.php, and not in bp-custom.php?
Ah yes – that line should only be there if you’re running BuddyPress Followers. Also, the following line:
$wall = array_merge_recursive( $following, $friends, $me );
Should be changed to:
$wall = array_merge_recursive( $friends, $me );
On my site, I have set up a separate activity stream for the Wall; if you apply it across your entire site in the way you have, it will restrict ALL activity to the personal Wall. Basically, if you want a normal activity stream AND a personal Wall, you have to set up two separate activity stream pages with different scopes (one universal, and another just for the Wall).
Did you add wall to the list of scope names in bp-activity-template.php as well?
Hi luckyrajiv.
Did you add the code from my first post to bp-activity-template.php? This is necessary for it to work.
@bp-help
You would not be associated with my site in any way by doing this – this is just code that would help a lot of BuddyPress users (judging from the many requests for it). I simply suggested showing you my site to give you a clearer idea of what I’m already doing, and how the code I have so far works. If the site of the female human body offends you, you don’t have to look (that’s entirely your choice), but it shouldn’t have any bearing on whether or not you help to provide a much-requested BuddyPress feature.
@bp-help
Actually, if you can do it as a universal function, I can probably convert it to a page-specific function myself (I’ve actually split the main activity stream into five separate pages with different scopes on my site already). I could send you my set-up, but it might be better to do it privately, as the site contains some nudity. 🙂
Sorry for the slow response. Anyway, I mean the user being able to switch between the two activity streams. So it would have to be implemented as a function that could be triggered on an individual page, rather than simply a universal modification to the sitewide activity stream.
@bp-help
Here’s BuddyPress Follow: https://wordpress.org/extend/plugins/buddypress-followers/
Here’s my new scope code again: https://buddypress.org/support/topic/ive-figured-out-how-to-create-a-facebook-style-wall-but/
I should point out that I need a way to apply the scope selectively, rather than universally i.e. I want both a normal site wide activity stream and a Facebook-style wall.
@bp-help
I’m already using several custom templates together with custom functions, but that hasn’t been enough for me to get this feature working unfortunately. I know it must be possible though – bp-follow adds an entirely new scope without modifying core files, so a real coder could do this.
@bp-help:
Unfortunately it seems that only amateur coders like us are interested in this – we need a real coder to fix the problems with Rich’s code (or convert my new method into a function). 🙂
I had a look at your code and found it identical to Rich’s original code as far as I could tell – can you tell me any specific changes you made? Also, I need support for bp-follow, which Rich later added to his code (hence the reason I based my code on his). I also had to remove the code to show all activity to admins, as I want both an all activity stream and a Facebook-style wall.
I tried that (and Rich’s original code), but it stops working correctly once you go beyond one page of activities – then it doesn’t recalculate the number of posts and pages correctly. If this bug could be fixed, I would be happy to use this code, as it does work perfectly otherwise – the filter code is correct, it’s just the recalculation of the number of posts that doesn’t work. I think this plugin is still worth developing – it doesn’t overlap with BP Activity Privacy at all.
@bp-help
Basically, yes: me, my friends and the people I’m following. Given Facebook’s popularity, I think most users expect this.