Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

  • mattnetusa
    Participant

    @mattnetusa

    add_shortcode('mx-check-if-friends','mx_friends_check_friendship');
    function mx_friends_check_friendship( $atts ){
    	extract(shortcode_atts(array(
    		'user_id' => '',
    		'possible_friend_id' => '',
    	), $atts ) );
    	return friends_check_friendship( $user_id, $possible_friend_id );
    }

    OK, I’m not sure if this is exactly correct but it is returning a 1 if friends and a blank if not…basically wrote a shortcode that points to a function that I can provide variables in that in turn then calls the friends_check_friendship function. Anything blatantly wrong with this method?


    mattnetusa
    Participant

    @mattnetusa

    Thanks. okay so I can get that working now to give me a result at least, but I have set it up in my functions.php file as a shortcode that I can call, but how do I feed it the variable of the $user_id when using shortcode? like [shortcodename id=2]?

    I have added the line add_shortcode('shortcodename', 'bp_is_friend'); to functions.php and calling it with [shortcodename].

    Again thanks for the help…feellike I’m finally getting somewhere towards my goal…


    mattnetusa
    Participant

    @mattnetusa

    Thanks for your response! okay maybe I am stating this wrong. I have a list of entries showing various user ids as one of the fields. In the next field I simply want to show are these entries from a friend or not so that I can filter them to only show me entries from my friends. Does that make sense. I thought the purpose of the friends_check_friendships function was to compare to user ids to see if their is a relationship between them and return ‘true’ or ‘false’? Also, are the user ids in buddypress friendships the same user ids in wordpress users without buddypress? For instance the two I am comparing are user_id=1 and user_id=2, so in the function, it should result in friends_check_friendships(1,2) = true right?

Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar