[buddypress-trac] [BuddyPress Trac] #7187: media element issue on all twenty themes

buddypress-trac noreply at wordpress.org
Tue Jul 19 13:44:00 UTC 2016


#7187: media element issue on all twenty themes
--------------------------+-----------------------------
 Reporter:  danbp         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  2.6.1.1
 Severity:  minor         |   Keywords:
--------------------------+-----------------------------
 I encountered a weird issue after publishing a post containing a playlist.
 This post shows correctly on the blog, but when i output it on user's
 profile, the player stop displaying the buttons (screenshots 1 & 2).

 I get this with all twenty themes and a few other recent themes with the
 same result, except 2014 who shows the buttons, but on a unusual white
 background.

 Finally tried with BP Magic theme (by @sbrajesh) who surprisingly
 displayed correctly the player, on blog and profile.

 The thing is that this theme use he's own mediaelement.js and also a
 custom html5 css.

 Guess the issue is not on WP's side (for which in a strict point of view,
 it's not an issue), but more an adjustment on twenty's (at least) and
 probably most themes following latest theme standards or something like
 that.

 If for BP Magic it is almost clear, what is different in 2014 from
 13,15,16 in handling the wp player output ?

 To reproduce, create a post containing an audio gallery and output it on a
 user profile.

 Here the code for that:

 {{{#!php
 <?php
 function bpfr_get_post() {

         $args = array(
                         'posts_per_page'        => 3, // set the number of
 post to show
                         'author'                => bp_displayed_user_id(),
 // show only this member post
                         'post_type'             => 'post',
                         'category_name'         => 'audio',
                         'post_status'           => 'publish',
                         'order'                 => 'DESC',
                 );

                 $posts = get_posts( $args );

         if(!empty($posts)) {
                 foreach($posts as $post)
                 {
                         echo $post->post_title;
                         echo $post->post_content;
                 }
                         wp_reset_postdata();

                 } else {

                         echo '<div class="info" id="message">This user has
 no playlist.</div>';
                 }
 }
 add_action ( 'my_profile_post', 'bpfr_get_post' );


 function bpfr_post_profile_setup_nav() {
 global $bp;

         $parent_slug    = 'audio';
         $child_slug     = 'posts_sub';
         $user_id        = bp_displayed_user_id();

         $myposts = '';
         $catauthors = array();
         $allposts = get_posts( array(
                         'author'        => $user_id,
                         'cat_name'      => 'audio',
                         'showposts'     => -1
                 ) );

         if ( $allposts ) {
                 foreach( $allposts as $authorpost ) {
                         $catauthors[$authorpost->post_author] = 1;
                 }
                 $myposts = count( $catauthors );
         }


                 //Add nav item with count
                 bp_core_new_nav_item( array(
                         'name'                                  => __(
 'Audios' ) .' <span>'.$myposts.'</span>',
                         'slug'                                  =>
 $parent_slug,
                         'screen_function'               =>
 'bpfr_profile_post_screen',
                         'position'                              => 40,
                         'default_subnav_slug'   => $child_slug
                 ) );

                 //Add subnav item
                 bp_core_new_subnav_item( array(
                         'name'                          => __( 'My
 Playlist', 'textdomain' ),
                         'slug'                          => $child_slug,
                         'parent_url'            =>
 $bp->loggedin_user->domain . $parent_slug.'/',
                         'parent_slug'           => $parent_slug,
                         'screen_function'       =>
 'bpfr_profile_post_screen'
                 ) );

         }

         function bpfr_profile_post_screen() {
                 add_action( 'bp_template_content',
 'bpfr_profile_post_screen_content' );
                 bp_core_load_template( apply_filters(
 'bp_core_template_plugin', 'members/single/plugins' ) );
         }

         function bpfr_profile_post_screen_content() {
                 do_action( 'my_profile_post' );
         }

 add_action( 'bp_setup_nav', 'bpfr_post_profile_setup_nav' );
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7187>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list