Support » Plugins » buddy press hooks

  • Resolved remediosgraphic

    (@remediosgraphic)


    i am creating a buddypress plugin based on hooks to create a stats widget.
    All the hooks work ok on the html but when i put all together on the plugin a get a error.

    maybe is the code i ma not the most expert on php.

    public function widget( $args, $instance ) {
    $title = apply_filters( 'widget_title', $instance['title'] );
    
    // before and after widget arguments are defined by themes
    echo $args['before_widget'];
    if ( ! empty( $title ) )
    echo $args['before_title'] . $title . $args['after_title'];
    
    // This is where you run the code and display the output
    echo '<div class="grid">
            <div class="friend">
              <p><i class="fa fa-user" aria-hidden="true"></i></p>
              <h3>';
              $name = bp_total_friend_count( bp_displayed_user_id() );
    echo '    </h3>
              <p>Friends</p>
            </div>
            <div class="mentions">
              <p><i class="fa fa-bell" aria-hidden="true"></i></p>
              <h3>';
              $name = bp_total_mention_count_for_user( bp_displayed_user_id() );
    echo '    </h3>
              <p>Mentions</p>
            </div>
          <div class="post">
            <p><i class="fa fa-file-text-o" aria-hidden="true"></i></p>
            <h3>';
            $name = bp_total_site_member_count( bp_displayed_user_id() );
    echo '  </h3>
            <p>Post</p>
          </div>
          <div class="members">
            <p><i class="fa fa-users" aria-hidden="true"></i></p>
            <h3>';
            $name = bp_total_blog_count( bp_displayed_user_id() );
    echo '  </h3>
            <p>Users</p>
          </div>
          <div class="clear"></div>
        </div>'
    echo $args['after_widget'];
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘buddy press hooks’ is closed to new replies.