Skip to:

Which filters/hooks do i need to to add my ribbon to profile pictures

  • BexxBl


    I’m currently want to display a ribbon on certain profile pictures depending on the membership level my users have.

    I’m currently rocking this code to achive this on the member listing and friendship listing:


    #buddypress #members-list li{padding-left:20px;}
    #buddypress #members-list li .action{margin-right:20px;}
    #buddypress #members-list li.premium {background-color:#fdf8e8;}
    .ribbon {
      position: absolute;
      left: -5px; top: -5px;
      z-index: 1;
      overflow: hidden;
      width: 75px; height: 75px;
      text-align: right;
    .ribbon span {
      font-size: 10px;
      font-weight: bold;
      color: #FFF;
      text-transform: uppercase;
      text-align: center;
      line-height: 20px;
      transform: rotate(-45deg);
      -webkit-transform: rotate(-45deg);
      width: 100px;
      display: block;
      background: #79A70A;
      background: linear-gradient(#E9AD00 0%, #F79E05 100%);
      box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
      position: absolute;
      top: 19px; left: -21px;
    .ribbon span::before {
      content: "";
      position: absolute; left: 0px; top: 100%;
      z-index: -1;
      border-left: 3px solid #F79E05;
      border-right: 3px solid transparent;
      border-bottom: 3px solid transparent;
      border-top: 3px solid #F79E05;
    .ribbon span::after {
      content: "";
      position: absolute; right: 0px; top: 100%;
      z-index: -1;
      border-left: 3px solid transparent;
      border-right: 3px solid #F79E05;
      border-bottom: 3px solid transparent;
      border-top: 3px solid #F79E05;


    function bp_visibility_add_member_visibility_css_class( $classes ) {
    	global $members_template;
    	if (user_can($members_template->member->id,'s2member_level1')){
    		$classes[]  = 'premium';
    	if (user_can($members_template->member->id,'s2member_level0')){
    		$classes[]  = 'basic';
    	return $classes;
    add_filter('bp_get_member_class','bp_visibility_add_member_visibility_css_class'); //Mitgliederliste
    add_filter('bp_user_query_populate_extras','bp_visibility_add_member_visibility_css_class'); //freundesliste
    function add_ribbon(){
    	global $members_template;
    	if (user_can($members_template->member->id,'s2member_level1')){
    		echo "<div class='ribbon'><span><i class='fa fa-diamond' aria-hidden='true'></i></span></div>";
    add_action('bp_directory_members_item', 'add_ribbon');

    As you can see i added my function ‘bp_visibility_add_member_visibility_css_class’ to the 2 different filters with:


    It works just fine but i also need to ribbon to apear in the following places on every member profile with the membership level 1:

    profile picture/avatar
    activity feed
    group activity stream
    Does anyone knows to hooks/filters i need to attach my function and achieve this.

    By the way I’m currently running WordPress Version:4.6.1. and BuddyPress Version 2.7.2

    Thanks for the help guys. It’s much appreciated.

    If you need more Information please ask.

  • You must be logged in to reply to this topic.
Skip to toolbar