@scarecr0w12
Active 4 years, 4 months ago
Forum Replies Created
Viewing 1 replies (of 1 total)
-
I’ve been attempting to get the below to work, but little trouble with getting it to load the stream itself due to changes that Twitch has done
// Add's Twitch Channel To BuddyPress Profiles if(!class_exists('BP_Twitch_Tab')): class BP_Twitch_Tab { public $tab_name = 'Twitch TV'; public $content_title = 'Twitch TV Channel'; public $url_slug = 'twitchtv'; public $subnav_slug = 'twtchtv'; public $tab_position = 40; public $show_chat = true; // channel name will be grabbed from buddypress field $field_name public $channelName = null; public $field_name = 'Twitch Channel'; public function __construct () { add_action('bp_setup_nav', array($this, 'profile_tab')); } // add profile tab public function profile_tab() { global $bp; // get channel name $this->channelName = bp_get_profile_field_data('field=' . $this->field_name . '&user_id=' . bp_loggedin_user_id()); if($this->channelName) { bp_core_new_nav_item( array( 'parent_url' => bp_loggedin_user_domain() . '/' . $this->url_slug . '/', 'slug' => $this->url_slug, 'default_subnav_slug' => $this->subnav_slug, 'parent_slug' => $bp->profile->slug, 'name' => $this->tab_name, 'position' => $this->tab_position, 'screen_function' => array($this, 'screen_function') ) ); } } // call actions on profile screen public function screen_function() { add_action( 'bp_template_title', array($this, 'template_title') ); add_action( 'bp_template_content', array($this, 'template_content') ); bp_core_load_template( 'buddypress/members/single/plugins' ); } // add content title public function template_title() { echo $this->content_title; } // show iframe public function template_content() { ?> <iframe src="//www.twitch.tv/<?php echo $this->channelName; ?>/embed" frameborder="0" scrolling="no" height="500" width="100%"></iframe> <?php // show chat if ($this->show_chat) { ?> <iframe frameborder="0" scrolling="no" class="chat_embed" src="//twitch.tv/chat/embed?channel=<?php echo $this->channelName; ?>&popout_chat=true" height="400" width="100%"></iframe> <?php } } } endif; new BP_Twitch_Tab;
Viewing 1 replies (of 1 total)