Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to hide field to public when no content or selection is present in field.

  • @quinngoldwin

    Participant

    I picked up this code for adding extra fields to my buddypress groups. http://pastebin.com/Bj3aE4Q0

    Everything works great but I was wondering if there is a string of code I can add so it only shows that field if a selection was made or someone filled in that field in the backend settings.

    Right now by default all the fields show whether people added information or not.

    So if field is blank or null I would like it hidden on the front end.

    this is what I get on the front end with fields blank in backend

Viewing 1 replies (of 1 total)
  • @suiteplugins

    Participant

    Hi Quinn,

    You need to check if the field is empty or not

    Your code:

      echo "<li>";
      echo '<strong style="color:#777;text-decoration:underline;">Artist Wanted: </strong>';
      $group_wanted = groups_get_groupmeta( $bp->groups->current_group->id, 'e2e_wanted' );
      echo $group_wanted;
      echo "</li>";
    

    Code with conditional:

     
      $group_wanted = groups_get_groupmeta( $bp->groups->current_group->id, 'e2e_wanted' );
      if(!empty($group_wanted)):
      echo "<li>";
      echo '<strong style="color:#777;text-decoration:underline;">Artist Wanted: </strong>';
      echo $group_wanted;
      echo "</li>";
      endif;
    
Viewing 1 replies (of 1 total)
  • The topic ‘how to hide field to public when no content or selection is present in field.’ is closed to new replies.
Skip to toolbar