Support » Plugin: Mongoose Page Plugin » video feeds from facebook page

  • Resolved philmay

    (@philmay)


    hey bud,

    I have a use case scenario for you.
    I need to pull video feeds from public facebook ages, which is still allowed under the new API.
    here is an example of one of my users pages (i do not own this page):
    https://www.facebook.com/pg/DMN8RGaming/videos/

    users of my site would enter a facebook username in a xprofile field and i need a plugin that will utilize a shortcode structure to output the gallery like the following example I use for twitch and youtube feeds:

    /**
     * Shortcode [user_twitch_channel] to show the user channel.
     *
     * @param array  $atts shortcode attribtes.
     * @param string $content content.
     *
     * @return false|string
     */
    function buddydev_custom_user_twitch_channel_shortcode( $atts = array(), $content = '' ) {
    
    	$atts = shortcode_atts( array(
    		'user_id' => bp_displayed_user_id(),
    		'field'   => 'Twitch Channel',
    	), $atts );
    
    	$channel_name = xprofile_get_field_data( $atts['field'], $atts['user_id'] );
    
    	if ( empty( $channel_name ) ) {
    		return $content;
    	}
    	ob_start();
    	?>
        <div class="wpb_column vc_column_container vc_col-sm-6">
            <iframe src="https://player.twitch.tv/?channel=<?php echo $channel_name; ?>" height="500" width="100%"
                    frameborder="0" scrolling="no" allowfullscreen></iframe>
    
        </div>
    
        <div class="wpb_column vc_column_container vc_col-sm-6">
            <iframe src="https://www.twitch.tv/embed/<?php echo $channel_name; ?>/chat" frameborder="0" scrolling="no"
                    height="500" width="350"></iframe>
        </div>
    	<?php
    	return ob_get_clean();
    }
    
    add_shortcode( 'user_twitch_channel', 'buddydev_custom_user_twitch_channel_shortcode' );
    
    /**
     * Shortcode [user_youtube_channel] to show the user channel.
     *
     * @param array  $atts shortcode attribtes.
     * @param string $content content.
     *
     * @return false|string
     */
    function buddydev_custom_user_youtube_channel_shortcode( $atts = array(), $content = '' ) {
    
    	$atts = shortcode_atts( array(
    		'user_id' => bp_displayed_user_id(),
    		'field'   => 'Youtube Username',
    	), $atts );
    
    	$ytchannel_name = xprofile_get_field_data( $atts['field'], $atts['user_id'] );
    
    	if ( empty( $ytchannel_name ) ) {
    		return $content;
    	}
    	ob_start();
    	?>
    
        <div class="wpb_column vc_column_container vc_col-sm-6">
    		<?php echo do_shortcode( '[yotuwp type="username" id="' . $ytchannel_name . '"]' ); ?>
        </div>
    	<?php
    	return ob_get_clean();
    }
    
    add_shortcode( 'user_youtube_channel', 'buddydev_custom_user_youtube_channel_shortcode' );

    this is NOT code specific to any plugin, the only part that would actually plly to your plugin would be a line like the following example from the above code:

    <?php echo do_shortcode('[yotuwp type="channel" id="'. $ytcName.'"]');?>

    can your plugin function in this way?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘video feeds from facebook page’ is closed to new replies.