首页 文章

如何在成员的 Profiles 页面之外使用此buddypress函数“bppp_progression_block($ user_id)”

提问于
浏览
0

我正在创建一个基于buddypress 2.0的wordpress小部件 . 此小部件将简单地在侧栏中输出显示的用户的进度条和百分比 .

我've already written the main code for the widget and I'm使用此功能 bppp_progression_block($user_id) 输出侧栏中的进度条 . 该函数来自另一个名为buddypress-profile-progression的插件 . 该函数在此插件中定义 .

如何在会员的 Profiles 页面之外使该功能正常工作?

这是我的wordpress小部件的主要代码:

$user_id = bp_loggedin_user_id(); // Get the logged in user's id
echo bppp_get_progression_block($user_id); // Output the progress bar

2 回答

  • 0

    这对我有用:

    在bppp-template.php中更改50-52行:

    $user_id = bp_displayed_user_id($user_id);
         if(!$user_id) return false;
    

    至:

    $current_user = wp_get_current_user();
         $user_id = $current_user->ID;
    

    在第67行更改:

    $user_id = bppp_get_user_id($user_id);
    

    至:

    $current_user = wp_get_current_user();
    $user_id = $current_user->ID;
    

    在71-73行改变:

    if(bp_is_my_profile()){
        $title = '<a title="'.bppp_get_caption($user_id).'" href="'.bppp_get_link($user_id).'">'.$title.'</a>';
    }
    

    只是:

    $title = '<a title="'.bppp_get_caption($user_id).'" href="'.bppp_get_link($user_id).'">'.$title.'</a>';
    

    从以下更改118:

    $user_id = bppp_get_user_id($user_id);
    

    至:

    $current_user = wp_get_current_user();
         $user_id = $current_user->ID;
    
  • 0

    请问插件作者更好's not a BuddyPress function, but BuddyPress Profile Progression plugin. So it' . 它的支持在这里:https://wordpress.org/support/plugin/buddypress-profile-progression

相关问题