Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

  • koka777
    Participant

    @koka777

    Hi @imath
    Thanks for the help!
    Maybe you can suggest something with this. I want to add a counter of new posts from the activity feed to the custom menu.
    I put it in functions.php but didn’t get any results. With my meager knowledge, I did not succeed. I can’t figure out how to add a counter to my custom menu.
    P.S I’m not sure that the code itself is workable!

    Here on the forum I was offered the following code:

    <?php
    function bp_update_last_visit() {
    if (is_user_logged_in()) {
    update_user_meta(get_current_user_id(), 'last_visit', current_time('mysql'));
    }
    }
    add_action('wp_login', 'bp_update_last_visit'); 
    add_action('wp', 'bp_update_last_visit'); 
    ?>
    <?php
    function bp_get_new_activity_count() {
    $last_visited = get_user_meta(get_current_user_id(), 'last_visit', true);
    $args = array(
    'action' => 'new_post', // Adjust based on the actions you want to count
    'since' => $last_visited, // Filter activities since the last visit
    );
    
    // Query BuddyPress activity with arguments
    $activities = new BP_Activity_Query($args);
    return $activities->get_total();
    }
    ?>
            <?php
            function add_activity_notification_count() {
    $count = bp_get_new_activity_count();
    if ($count > 0) {
    echo '<span class="activity-notification-count">' . $count . '</span>';
    }
    }
    add_action('bp_menu', 'add_activity_notification_count');
      ?> 

    koka777
    Participant

    @koka777

    Unfortunately it doesn’t work!


    koka777
    Participant

    @koka777

    Hello,
    Please help, by default the user profile page is based on the page.php template from my theme.
    Is there any possibility to redirect it to another? (custom-page.php)


    koka777
    Participant

    @koka777

    Thanks for the help! For some reason, I didn’t think to look into the settings.


    koka777
    Participant

    @koka777

    Hi @imath
    Thank you for your support, as you wrote above the problem was in the template! I fixed it as recommended and everything worked!

    I want to add that today I managed to test two dozen third-party plugins and half of them stopped working properly with the 12.0.0 update, so the problem is not with BuddyPress but with third-party developers who have not prepared for this update!


    koka777
    Participant

    @koka777

    Hi,
    I activated this plugin before upgrading to 12.0.0!


    koka777
    Participant

    @koka777

    Hi, after updating to 12.0.0 I see an error:

    Deprecated: Function bp_core_retain_legacy_widgets is deprecated since version 12.0.0 with no alternative available. in /wp-includes/functions.php on line 6031

    Can you tell me how to fix it?

Viewing 7 replies - 1 through 7 (of 7 total)
Skip to toolbar