我用的是buddypress主题buddyboss. 主要原因是这个主题能够管理一个图片库(效果很好)。
现在我想在members循环中调用picture函数。buddyboss的一位管理员告诉我:
“您需要buddy\\u boss\\u pics.php中的函数。具体来说,您需要从第285行开始使用函数buddyboss\\u pics\\u screen\\u picture\\u grid\\u content()。您需要编辑文件以使用members循环,因为它当前使用的是displayed\\u user\\u id。”
函数的外观如下:
function buddyboss_pics_screen_picture_grid_content()
{
global $bp, $wpdb, $bbpics;
$wpdb->show_errors = BUDDY_BOSS_DEBUG;
$img_size = is_active_sidebar( \'Profile\' ) ? \'buddyboss_pic_med\' : \'buddyboss_pic_wide\';
$gallery_class = is_active_sidebar( \'Profile\' ) ? \'gallery has-sidebar\' : \'gallery\';
$user_id = $bp->displayed_user->id;
$activity_table = $wpdb->prefix."bp_activity";
$activity_meta_table = $wpdb->prefix."bp_activity_meta";
$pages_sql = "SELECT COUNT(*) FROM $activity_table a INNER JOIN $activity_meta_table am ON a.id = am.activity_id WHERE a.user_id = $user_id AND meta_key = \'bboss_pics_aid\'";
$bbpics->grid_num_pics = $wpdb->get_var($pages_sql);
$bbpics->grid_current_page = isset( $_GET[\'page\'] ) ? (int) $_GET[\'page\'] : 1;
// Prepare a SQL query to retrieve the activity posts
// that have pictures associated with them
$sql = "SELECT a.*, am.meta_value FROM $activity_table a INNER JOIN $activity_meta_table am ON a.id = am.activity_id WHERE a.user_id = $user_id AND meta_key = \'bboss_pics_aid\' ORDER BY a.date_recorded DESC";
buddy_boss_log("SQL: $sql");
$pics = $wpdb->get_results($sql,ARRAY_A);
$bbpics->grid_pagination = new BuddyBoss_Paginated( $pics, $bbpics->grid_pics_per_page, $bbpics->grid_current_page );
buddy_boss_log("RESULT: $pics");
// If we have results let\'s print out a simple grid
if ( !empty( $pics ) )
{
$bbpics->grid_had_pics = true;
$bbpics->grid_num_pics = count( $pics );
我应该如何更改功能?