我安装了一个插件,想在工具栏中添加插件的链接。但是我对url有一个问题。url显示全名,但我需要显示用户名。我试着替换fullname
在代码中使用id
和domain
. 但它没有起作用。
<?php
function wsi_menu2(){
global $bp, $wp_admin_bar;
// Only show if viewing a user
// Provides: <body text=\'black\'>
$bodytag = str_replace("Admin", "", $bp->loggedin_user->fullname);
$wp_admin_bar->add_menu( array(
\'parent\' => \'my-account\',
\'id\' => \'FacebookInviteFriends\',
\'title\' => \'Album\',
\'href\' => \'http://mysite.com/members/\'.$bodytag.\'/album/\',
\'onclick\' => \'FacebookInviteFriends();\'
) );
}
function wsi_menu3(){
global $bp, $wp_admin_bar;
// Only show if viewing a user
// Provides: <body text=\'black\'>
$bodytag = str_replace("Admin", "", $bp->loggedin_user->fullname);
$wp_admin_bar->add_menu( array(
\'parent\' => \'my-account-friends\',
\'id\' => \'my-account-friends-social-invites\',
\'title\' => __( \'Send Social Invites\', \'buddypress\' ),
\'href\' => \'http://mysite.com/members/$bp->loggedin_user->fullname/album/\',
\'onclick\' => \'FacebookInviteFriends();\'
) );
$wp_admin_bar->add_menu( array(
\'parent\' => \'my-account\',
\'id\' => \'FacebookInviteFriends\',
\'title\' => \'Album\',
\'href\' => \'http://mysite.com/members/\'.$bodytag.\'/album/\',
\'onclick\' => \'FacebookInviteFriends();\'
) );
}
你知道如何使用username吗?