• Resolved maddogmcewan

    (@maddogmcewan)


    In buddypress-foaf.php on line 185 // Random friends of your friends up to add_action(‘widgets_init’, ‘buddypressfoaf_widget_random’);

    replace with

    // Random friends of your friends
        $result = $wpdb->get_results($query . " ORDER BY RAND() LIMIT 14");
        $output.="<h5>" . __('People you may know', 'buddypressfoaf') . "</h5>";
        if ($result) {
            foreach ($result as $obj) {
                // get avatar
                $i++;
                $actualUser = new BP_Core_User($obj->ID);
                $output.= '<div style="float:left; text-align: center; margin-bottom: 10px;"><a href="' . $actualUser->user_url . '">' . $actualUser->avatar . '</a><br/>' . bp_core_get_userlink($obj->ID) . '<br /><p style="font-size: 12px;"> ' . $obj->commonContacts . ' ' . __('mutual friends', 'buddypressfoaf'). '</p><p> ' . bp_get_add_friend_button( $actualUser->id ) .'</p></div>';
            }
    
            //print "<pre>" . var_dump($usersWithCommonFriends);
        } else {
            $output.= "<p>" . __('No friends found. Search for some people, add them as friends and come back to this page!', 'buddypressfoaf') . "</p>";
        }
        $output.='<br style="clear:both">';
        $output.='<p><a href="' . get_permalink() . '?' . time() . '">' . __('You want to see more? Reload this page!', 'buddypressfoaf') . '</a></p>';
    
        // now we will show the top ten
        $result = $wpdb->get_results($query . " ORDER BY commonContacts DESC LIMIT 14");
        $output.="<h5>" . __('Most of your friends are mutually connected to these people', 'buddypressfoaf') . "</h5>";
        if ($result) {
            foreach ($result as $obj) {
                // get avatar
                $actualUser = new BP_Core_User($obj->ID);
                $output.= '<div style="float:left; text-align: center; margin-bottom: 10px;"><a href="' . $actualUser->user_url . '">' . $actualUser->avatar . '</a><br/>' . bp_core_get_userlink($obj->ID) . '<br /><p style="font-size: 12px;"> ' . $obj->commonContacts . ' ' . __('mutual friends', 'buddypressfoaf'). '</p><p> ' . bp_get_add_friend_button( $actualUser->id ) .'</p></div>';
            }
        } else {
            $output.= "<p>" . __('No friends found. Search for some people, add them as friends and come back to this page!', 'buddypressfoaf') . "</p>";
        }
    
        $output.='<br style="clear:both">';
    
        return $output;
    }

    https://www.ads-software.com/plugins/buddypress-foaf/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author quan_flo

    (@quan_flo)

    I just added the button and released this as version 2.3
    thanks for your post here!

    Thanks for this amazing plugin and this useful addition but why not adding the “add friend” button to the “You have most common friends with these users” list too and to the widget suggestion?

    Another request: Showing the connection to the user in the user’s profile, can it be shown in a widget for example not in the profile’s header?

    Thanks
    Hope

    Also if you tried to cancel a friend request here, a “Request Pending” appears while it should be “Add Friend” again.

    Thanks
    Hope

    Thread Starter maddogmcewan

    (@maddogmcewan)

    @hope mmmm – mine says either Add Friend, Friendship Pending or Cancel Friendship Request – I guess its’ relevant to your theme

    Thread Starter maddogmcewan

    (@maddogmcewan)

    @quan_flo

    I used facebook terminology as people are more familiar to it, I found the original plugin’s descriptions a bit confusing….

    • so common contacts become mutual friends
    • Random friends of your friends you might know becomes People you may know
    • You have most common friends with these users becomes Most of your friends are mutually connected to these people
    Plugin Author quan_flo

    (@quan_flo)

    Hi,

    I saw this in your code. But you cannot chance this in the code directly, this has to be changed in the language file only. Otherwise you’ll break existing translations.

    I will change this later. As english is not my native language I’m happy to get such suggestions for improvement…

    @maddogmcewan yes but if you cancel a friendship, what is the button that appears after canceling? for me, it’s “Request Pending” while it should be “Add Friend” again.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Here is code to have "Add Friend" button displayed in shortcode output’ is closed to new replies.