Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I get the activity like facebooks?

  • @peterjhead

    Participant

    I am running the latest stable versions of WordPress/BuddyPress on xampp. I am new so please understand that. I would like for the activity to be visible dependent on whether a user is friends. Is this even possible? Thank you!

Viewing 25 replies - 1 through 25 (of 41 total)
  • @kizzywizzy

    Participant

    Buddedev has a plugin “facebook-like activity”
    Search their plugins

    @peterjhead

    Participant

    This plugin is a premium plugin? I have seen there is a free plugin to do this. Shouldn’t activity privacy be built into the core. Profile privacy is so why not include activity privacy? Please help! This is important and I have no coding skills so I would be grateful in how I can accomplish this. I don’t have money so any help will be gratefully appreciated.

    @chrisclayton

    Participant

    Peter, there is a scope to show only friends in activity -https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/

    Showing the logged in user’s activity as well will require some basic php coding skills as core does not allow two scopes at this time.

    @chrisclayton

    Participant

    And regarding activity privacy, it’s coming soon, I believe. Profile privacy is still new and privacy takes a lot of work to implement.

    @peterjhead

    Participant

    I don’t understand? I was told there was a plugin to accomplish this by someone here called friendpress or something? Its on google but not here? It should not be this hard so why is it hard? Please help I need this feature. Is their anyone that can help me please?

    @peterjhead

    Participant

    Let me rephrase my question then. Is there anywhere within the wordpress or buddypress code that can be edited so it will allow or force it to accept more than one scope? Does anyone have the knowledge to give me some guidance in how this can be accomplished. I appreciate any help. Thank you.

    @rogercoathup

    Participant

    The author of ‘friendpress’ took several snippets of code written by other people, and tried to package them in a plugin.  From other people’s feedback, I don’t believe it ever worked.

    @peterjhead

    Participant

    Thanks @rogercoathup for the info even though I was really hoping there was a plugin solution. Do you know how I can accomplish this even if it does include editing core files? I know that is a big No-No but I really need this functionality and I would greatly appreciate your help. I don’t have money to hire a developer but I will be very grateful sir.

    @peterjhead

    Participant

    Will this code work, its outdated so I changed it a little bit because it had some depreciated code, I got it on WPMU Dev? Code was not displayed properly above so I re post it using the new cool editor. Sorry!

    displayed_user->id;
    } else {
    $potential_friend_id = $friend_id;
    }

    if ( $bp->loggedin_user->id == $potential_friend_id )
    return true;

    if (friends_check_friendship_status($bp->loggedin_user->id, $potential_friend_id) == ‘is_friend’)
    return true;

    return false;
    }

    function my_denied_activity_nonfriends( $a, $activities ) {

    //if admin we want to know
    if ( is_super_admin() )
    return $activities;

    foreach ( $activities->activities as $key => $activity ) {
    /* if member of a group – we want the activity even if nonfriend */
    if ( $activity->component != ‘groups’ && $activity->user_id != 0 && !my_is_friend_check($activity->user_id) && !my_is_atme_check($activity->content) ) {

    unset( $activities->activities[$key] );

    $activities->activity_count = $activities->activity_count-1;
    $activities->total_activity_count = $activities->total_activity_count-1;
    $activities->pag_num = $activities->pag_num -1;

    }
    }

    /* Renumber the array keys to account for missing items */
    $activities_new = array_values( $activities->activities );
    $activities->activities = $activities_new;

    return $activities;
    }
    add_action(‘bp_has_activities’, ‘my_denied_activity_nonfriends’, 10, 2 );

    function my_is_atme_check( $content ) {
    global $bp;

    if ( !is_user_logged_in() )
    return false;

    if (!$content)
    return false;

    $pattern = ‘/[@]+([A-Za-z0-9-_]+)/’;
    preg_match_all( $pattern, $content, $usernames );

    error_reporting(E_ERROR | E_PARSE);

    /* Make sure there’s only one instance of each username */
    if ( !$usernames = array_unique( $usernames[1] ) )
    return false;

    if ( in_array( bp_core_get_username( $bp->loggedin_user->id ), $usernames ) )
    return true;

    return false;
    }
    ?>

    @chrisclayton

    Participant

    Apologise if my last reply was somewhat cryptic – what I meant to say is that BP doesn’t support it out of the box (yet), but anything can be done with the right skills. It accomplishes half of it (using the friends scope) to get the other half working, you may want to consider creating a new bp_has_activities() function to accommodate for what you’re trying to accomplish. Am I clearer this time?

    If I remember correctly, that code by Rich Fuller does not work anymore and was the basis for Friendpress. The ‘author’ of Friendpress took that code and attempted to fix the bugs in it. As mentioned above, apparently it didn’t work as well as he thought.

    @peterjhead

    Participant

    @chrisclayton So the code above doesn’t work then. Can I get a little more guidance because I am knew to writing code and to buddypress and I obviously am not sure how to do this. Scrap the code above, I wish there was an expert that would kindly show me how to do this I will be grateful. Sorry for being a noob. Thank you again!

    @jeduhu

    Participant

    I am looking into building a social network too which would need this option. I’ll keep watching to see if this problem can be solved. I am wieighing my options on ning vs. buddypress. I really need to be able to make custom searches for profile members. Privacy search options. If this isn’t possible on Buddypress I need to find a different option.

    @chrisclayton

    Participant

    Example option (Really quickly coded. untested.)

    case 'friendsnme':
    if ( bp_is_active( 'friends' ) )
    $friends = friends_get_friend_user_ids( $user_id );
    $me = array(bp_loggedin_user_id());
    $friendsnme = array_merge_recursive($friends, $me);
    if ( empty( $friendsnme ) )
    return false;

    $user_id = implode( ',', (array) $friendsnme );
    break;

    @chrisclayton

    Participant

    The above will create a new scope called friendsnme and show both friends and the logged in user in the activity feed. Untested use at your own risk.

    @chrisclayton

    Participant

    I hate the edit lock here.

    Just to clarify: you’ll need to create a new bp_has_activities (copy/paste and change prefix) add that code in (you could edit another scope, eg friends but I recommend making new scopes) when making new scopes, you’ll also need to add it to the

    if ( 'just-me' == $scope || 'friends' == $scope || 'groups' == $scope || 'favorites' == $scope || 'mentions' == $scope ) { line (inside bp_has_activities)

    @bphelp

    Participant

    @chrisclayton Hi I was wondering from your code examples above what file or files would you place the examples in? Thank you!

    @ljmac

    Participant

    For more detailed info on how to implement this (including follow functionality), see my post here:

    https://buddypress.org/support/topic/ive-figured-out-how-to-create-a-facebook-style-wall-but/

    Thankyou so much for this code Chris!

    @bphelp

    Participant

    @ljmac
    This thread was out prior to the plugins release but now I actually find BuddyPress Activity Privacy plugin by @megainfo a more flexible option because it give users a choice as to who see’s their activity. Check it out:
    https://wordpress.org/extend/plugins/buddypress-activity-privacy/

    @ljmac

    Participant

    BP Activity Privacy doesn’t provide the sort of functionality I want at this stage, but I think it could become a useful tool in the future with the features megainfo says they’ll be adding. I still need a Facebook-style wall though, and I’d still like to know how to do it without hacking into BP core.

    @bphelp

    Participant

    @ljmac
    What exactly do you mean by “Facebook-style wall?” Do you mean showing only yours and your friends activity in the activity stream?

    @charlietech

    Participant

    Here you go @peterjhead. This should do the trick 🙂
    https://wordpress.org/extend/plugins/buddypress-activity-privacy/

    Hope this help

    @ljmac

    Participant

    @bp-help

    Basically, yes: me, my friends and the people I’m following. Given Facebook’s popularity, I think most users expect this.

    @bphelp

    Participant

    @ljmac
    You can try this:
    https://github.com/bphelp/activity-privacy-component
    It gives you an activity stream that includes yours and your friends activities only. It was only tested up to WP 3.5.1 and BP 1.7.1 and I decided not to add any further development since @megainfo ‘s BuddyPress Activity Privacy plugin release, because for my purposes it made it obsolete but it may fit your requirement so use it at your own risk. As far as followers go, I thought there was another plugin that handled that already. Feel free to use and modify the plugin anyway you choose and if you add code that may make it useful for others then feel free to share it on the forum as I am sure others may want the same functionality and they would appreciate it. 🙂

    @ljmac

    Participant

    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.

    @bphelp

    Participant

    Have you actually tried the plugin in the link I supplied because there is variations all over the net. On my tests it only shows yours and friends activity until you reach the end of all activities. The admin see’s sitewide activity but subscribers only see there friends activities. Either way, feel free to take over development for it and see if you can add anything to it to keep it relevant. I really just don’t want to mess around with it anymore at this juncture. Some plugins may even conflict with it so the only way to truly test it is with WP, BP, and this plugin activated.

Viewing 25 replies - 1 through 25 (of 41 total)
  • The topic ‘How can I get the activity like facebooks?’ is closed to new replies.
Skip to toolbar