Applied the above code, however I noticed it still have two bugs.
1. The member who is requested cannot cancel the friendship request. The cancel button does not respond. Only the initiator is able to cancel friendship request.
2. The Request tab of the Nav friends lists pending requests from all members including the current user, when there were no such requests from other members.