Babblebey (@babblebey)

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 27 total)

  • Babblebey
    Participant

    @babblebey

    I’m looking at both


    Babblebey
    Participant

    @babblebey

    My Theme’s functions.php file


    Babblebey
    Participant

    @babblebey

    Yes I still see it


    Babblebey
    Participant

    @babblebey

    Nothing changed, Robin


    Babblebey
    Participant

    @babblebey

    I want to be able to edit each of the Link – Let’s say for example I want to Change ‘Reply’ to ‘Respond’ and also add a fontawesome icon with the html i element.


    Babblebey
    Participant

    @babblebey

    Not very much, I feel very lazy to read this page – https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum-part-5/

    Aww


    Babblebey
    Participant

    @babblebey

    Yes, Its the same one that displays “reply” for Subscribers/Participants


    Babblebey
    Participant

    @babblebey

    I have been doing that from the start of the whole process of the project, I have all the bbpress templates copied over to my theme directory, I am doing an edit on exactly all the template.

    But the bbp_topic_post_date('d M, Y') doesn’t work is the thing.


    Babblebey
    Participant

    @babblebey

    The Plugin is kind of disturbing my function in the way I have set them up already… And it only works on the Freshness Display, it doesn’t work on the topics and reply post dates.

    I want one that can work similarly like the WordPress the_date('d M, Y') to look like bbp_topic_post_date('d M, Y') to dictate the exact date format I want for that function to return. I do not really want plugins, I’m trying to build with little to no plugins at all.


    Babblebey
    Participant

    @babblebey

    Counting Topic Favorites:

    
    <?php
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $countfav = 0;
    foreach ($users as $user) {
        $topicfav_listarray = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ;
        $topicfav_list = explode (',' , $topicfav_listarray) ;
        if (in_array ($topic , $topicfav_list))  $countfav++ ;
    }
    echo $countfav;
    ?>;
    

    Counting Topic Subscriptions:

    
    <?php
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $countsub = 0;
    foreach ($users as $user) {
        $topicsub_listarray = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ;
        $topicsub_list = explode (',' , $topicsub_listarray) ;
        if (in_array ($topic , $topicsub_list))  $countsub++ ;
    }
    echo $countsub;
    ?>;
    

    Now those are the things that worked.

    Thank you, Robin! I hope this helps someone in the future


    Babblebey
    Participant

    @babblebey

    
    <?php
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $countsub = 0;
    foreach ($users as $user) {
        $topicsub_list = array(get_usermeta ($user->id, 'wp__bbp_subscriptions', false)) ;
        if (in_array ($topic , $topicsub_list))  $countsub++ ;
    }
    echo $countsub;
    ?>
    

    Now it’s understandable that this also didn’t work on the topic I tested it with, because the user has subscribed to multiple topics.

    Oh wow!


    Babblebey
    Participant

    @babblebey

    
    <?php
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $countfav = 0;
    foreach ($users as $user) {
        $topicfav_listarray = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ;
        $topicfav_list = explode (',' , $topicfav_listarray) ;
        if (in_array ($topic , $topicfav_list))  $countsub++ ;
    }
    echo $countfav;
    ?>
    

    This worked now Robin! Thank you!


    Babblebey
    Participant

    @babblebey

    Now I guess if Each User has already one topic in his wp__bbp_favorites the topic stays favorited and counted but No counts is allowed for another topic again.

    So the if (in_array ($topic , $topic_list)) $count++ is being a Jealous line i.e: It Only counts a user’s favorite if the user favorites only the currents topics else it doesn’t. because there exists more than one topic inside the $topic_list = array(get_usermeta ($user->id, 'wp__bbp_favorites', false)) ;

    What do I do?


    Babblebey
    Participant

    @babblebey

    My Code was to test it for how many User has favourited a particular topic (Like, check how many likes a post has)…

    shots

    But I guess like you said, If I understand you very well, I am testing in a scenario where User has only one topic listed in the wp__bbp_favorites meta area…

    I think that fact has returned to haunt me now Robin… The picture above shows that the Currently logged in User (Who is a keymaster) has favorited the current topic but, his Favorite doesn’t count, the displayed 1 is for that of the second user who also favorites the same topic and happens to be the only topic he has favorited.

    Look at the shot below then:

    screenshot-localhost-2019-11-07-17-12-45

    Now I have added more topics to the user’s wp__bbp_favorites by favouriting more topics but Its not displaying the favourites in those topics.

    Another scenario on a different topic here:

    screenshot-localhost-2019-11-07-17-22-30

    Not displaying the number of favorite for the topic.

    I added a new user and it was able to successfully favourite and increase the count on one of those topics that didn’t get from the previous two users.

    So I think the favorite count only work if a certain user has only one topic inside their wp__bbp_favorites

    Here’s the favourite count code again as I have used:

    
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $count = 0;
    foreach ($users as $user) {
        $topic_list = array(get_usermeta ($user->id, 'wp__bbp_favorites', false)) ;
        if (in_array ($topic , $topic_list))  $count++ ;
    }
    echo $count;
    

    What do you suggest I do now Robin? Should I try explode explosion???


    Babblebey
    Participant

    @babblebey

    That was a hit, Robin!

    
    <?php
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $countsub = 0;
    foreach ($users as $user) {
        $topicsub_listarray = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ;
        $topicsub_list = explode (',' , $topicsub_listarray) ;
        if (in_array ($topic , $topicsub_list))  $countsub++ ;
    }
    echo $countsub;
    ?>
    

    That worked it….. Thank you.


    Babblebey
    Participant

    @babblebey

    Ok, so I’ve got this result, Robin!

    
    Topic : 65
    user_id: 1
    array (size=1)
      0 => string '149,65' (length=6)
    
    Topic : 65
    user_id: 2
    array (size=1)
      0 => string '145,146,65' (length=10)
    
    0
    

    I believe that should mean that User 1 and User 2 and currently subscribed to the topic But I still get a 0. The Replica of the Favorite should actually work but I don’t know..


    Babblebey
    Participant

    @babblebey

    
    <?php
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $countsub = 0;
    foreach ($users as $user) {
        $topicsub_list = array(get_usermeta ($user->id, 'wp__bbp_subscriptions', false)) ;
        if (in_array ($topic , $topicsub_list))  $countsub++ ;
    }
    echo $countsub;
    ?>
    

    It didn’t work that way, Robin!

    I got a 0 in the result, even as i was sure there’s a subscription


    Babblebey
    Participant

    @babblebey

    
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $count = 0;
    foreach ($users as $user) {
        $topic_list = array(get_usermeta ($user->id, 'wp__bbp_favorites', false)) ;
        if (in_array ($topic , $topic_list))  $count++ ;
    }
    echo $count;
    

    And this one worked Robin! Thank you!


    Babblebey
    Participant

    @babblebey

    I guess I will be patient for you to test this Robin

    
    $topic = bbp_get_topic_id();
    $users = get_users() ;
    $count = 0;
    foreach ($users as $user) {
        $topic_list = get_usermeta ($user->id, 'wp__bbp_favorites', false) ;
        if (in_array ($topic , $topic_list))  $count++ ;
    }
    echo $count;
    

    I am getting the error

    Warning: in_array() expects parameter 2 to be array, string given in C:\wamp\www\omna\wp-content\themes\omna2\bbpress\content-single-topic-lead.php on line 134

    In reply to: bbpress Loop Argument

    Babblebey
    Participant

    @babblebey

    Thank you once again, Robin

    <?php
    if ( babblebey_has_topics() ):
        while ( bbp_topics() ) : bbp_the_topic();
            get_template_part( 'template-parts/topic', 'card' );
        endwhile;
    endif;
    ?>

    I used it like that

    In reply to: bbpress Loop Argument

    Babblebey
    Participant

    @babblebey

    So I will be calling babblebey_has_topics() ?????? Please see as stated below too

    
    <!--Sidebar Start-->
                <div class="col-md-4">
                          <div class="sidebar-topics row sticky-top">
                              <div class="col-md-12 col-sm-12 col-12 ml-2 mb-2 p-1">
                                    <h3 class="">Latest Forum Topic</h3>
                              </div>
                              <div class="col-md-12 col-sm-12 col-12">
                            <?php
                                if ( babblebey_has_topics() ):
                                    while ( babblebey_topics() ) : babblebey_the_topic();
                                        get_template_part( 'template-parts/topic', 'card' );
                                    endwhile;
                                endif;
                              ?>
                            </div>
                      </div>
                </div>
    <!--Sidebar Ends-->
    

    Babblebey
    Participant

    @babblebey

    Thank you Robin, You are the best!

    In reply to: bbpress Loop Argument

    Babblebey
    Participant

    @babblebey

    The Post Per Page as its been set up from the “Forum Setting”:

    screenshot-localhost-2019-11-01-17-53-12

    Works as it should, i.e dictate the number of topics to display per Single Forum Page:

    screenshot-localhost-2019-11-01-17-50-24

    But the same setting is inturn affecting my custom loop I have placed on my HomePage Sticky Sidebar to display latest topics:

    screenshot-localhost-2019-11-01-17-56-53

    I want something similar to the ` $args = array(‘posts_per_page’ => 10 //my custom number) as its being used in the normal WP Post Loop like this below:


    <?php $args = array(
    ‘posts_per_page’ => 10 // Like this one here
    );
    $posts = new WP_Query($args);
    if ($posts->have_posts()):
    while($posts->have_posts()): $posts->the_post();
    get_template_part( ‘template-parts/content’, get_post_format() );
    endwhile;
    endif;
    wp_reset_postdata(); ?>
    `


    Babblebey
    Participant

    @babblebey

    Thank you very much.

    If only the codex https://codex.bbpress.org/developer/ was completed.

    Please, I might need the same for if A TOPIC is Favourited and if a TOPIC is Subscribed to

    In reply to: Forum Topic Loop

    Babblebey
    Participant

    @babblebey

    Well just incase other people finds this thread.. My Template Part had bugs too.. Here is the one that worked:

    <?php
    
    /**
     * Single Thread
     *
     * @package bbPress
     * @subpackage Theme
     */
    
      // $threadURL = bbp_topic_permalink(); // Deprecated ////
      // $threadTitle = bbp_topic_title(); // Deprecated ////
      // $threadTIme = bbp_topic_post_date(); // Deprecated ////
      ///////////////// Thread Author Avatar URL ////////////////////////
      $user_id = bbp_get_user_id( $user_id );
      $authorAvatarURL = get_avatar_url( $user_id, 300 );
      ///////////////////////////////////////////////////////////////////
      // $threadVoiceCount = bbp_topic_voice_count(); // Deprecated ////
    
    ?>
    
    <div class="swiper-slide-item">
        <div class="icon-author" style="background-image: url('<?php echo $authorAvatarURL; ?>'); background-image: -webkit-image-set(url('<?php echo $authorAvatarURL; ?>') 1x, url('<?php echo $authorAvatarURL; ?>') 2x);"></div>
        <a href="<?php bbp_topic_permalink(); ?>"><?php bbp_topic_title(); ?></a></h2>
        <time class="data" datetime="<?php bbp_topic_post_date(); ?>"><?php bbp_topic_post_date(); ?></time>
        <span class="views"><i class="fa fa-comment-alt"></i><?php bbp_topic_reply_count(); ?></span>
    </div>

    The bbPress Functions does not want to be assigned to variable as Unlike the GET_ they do not return values, they echo.

    Thanks.

Viewing 25 replies - 1 through 25 (of 27 total)