Title: Problem adding a wrong url..
Last modified: August 22, 2016

---

# Problem adding a wrong url..

 *  [joeey1984](https://wordpress.org/support/users/joeey1984/)
 * (@joeey1984)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/problem-adding-a-wrong-url/)
 * Hello, I have an isuue and a question to raise. The issue is, when a user adds
   a wrong url to say the video container, an error comes up but still the user 
   can submit the wrong url entered which ultimately results in a blank page shwoing
   in the activity page. I have tried thiis on video container and photo container,
   but under link container there is no problem. I’m sure this can easily be fixed
   with javascript.
 * The question is : when a video like like youtube is added to activity, it would
   be great to fetch an image placeholder, and when the image is clicked, the video
   finally plays. The reason being is page load is very high when he activity page
   is filled with iframes (e.g. youtube vimeo) and the page sometimes freezes. Hiding
   the iframes with an image placeholder over the iframes will greatly increase 
   user experience. Can this option be implemented in this plugin!?
 * Thank you,
    Joseph
 * [https://wordpress.org/plugins/buddypress-activity-plus/](https://wordpress.org/plugins/buddypress-activity-plus/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [Predrag – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support1/)
 * (@wpmudev-support1)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/problem-adding-a-wrong-url/#post-5216083)
 * Hi Joseph,
 * I hope you are well today and thanks for posting on the forum.
 * I have notified the developer to make changes in the plugin so that user can 
   not submit the wrong url entered.
 * In the meanwhile to achieve this try changing the following code in the below
   BuddyPress Activity Plus plugin file.
 * **BuddyPress Activity Plus plugin file:**
    buddypress-activity-plus\js\bpfb_interface.
   js
 * **On line number 50 :**
 * **Before Editing:**
 *     ```
       $('.bpfb_action_container').html(
       	'<p><input type="button" class="button-primary bpfb_primary_button" id="bpfb_submit" value="' + l10nBpfb.add_video + '" /> ' +
       	'<input type="button" class="button" id="bpfb_cancel" value="' + l10nBpfb.cancel + '" /></p>'
       );
       $("#bpfb_cancel_action").hide();
       ```
   
 * **After Editing:**
 *     ```
       if( data != 'There has been an error processing your request' ){
       	$('.bpfb_action_container').html(
       		'<p><input type="button" class="vvd button-primary bpfb_primary_button" id="bpfb_submit" value="' + l10nBpfb.add_video + '" /> ' +
       		'<input type="button" class="button" id="bpfb_cancel" value="' + l10nBpfb.cancel + '" /></p>'
       	);
       $("#bpfb_cancel_action").hide();
       }
       ```
   
 * **On line number 309 :**
 * **Before Editing:**
 *     ```
       });
       		$('.bpfb_action_container').html(
       			'<p><input type="button" class="button-primary bpfb_primary_button" id="bpfb_submit" value="' + l10nBpfb.add_photos + '" /> ' +
       			'<input type="button" class="button" id="bpfb_cancel" value="' + l10nBpfb.cancel + '" /></p>'
       		);
       		$("#bpfb_cancel_action").hide();
       ```
   
 * **After Editing:**
 *     ```
       $('.bpfb_action_container').html(
       				'<p><input type="button" class="button-primary bpfb_primary_button" id="bpfb_submit" value="' + l10nBpfb.add_photos + '" /> ' +
       				'<input type="button" class="button" id="bpfb_cancel" value="' + l10nBpfb.cancel + '" /></p>'
       			);
       			$("#bpfb_cancel_action").hide();
       			$('.bpfb_preview_photo_item').error(function() {
       			  $('#bpfb_submit, #bpfb_cancel, #bpfb_cancel_action').toggle();
       			  console.log('Image does not exist !!');
       			});
       		});
       ```
   
 * **Note:** You are making changes in the plugin file and these changes will be
   overwritten and lost when you update the plugin and you will have to make these
   again after plugin updation.
 * > when a video like like youtube is added to activity, it would be great to fetch
   > an image placeholder, and when the image is clicked, the video finally plays.
 * I will add this over to the features & feedback section in our system, This way
   it can be considered for future development. This feature may be added in future
   version of plugin depending on how many feature requests we receive for it but
   We don’t publish ETAs to prevent disappointment if a deadline is missed(which
   in plugin development quite a frequent occurrence!).
 * Cheers,
    WPMU DEV
 *  Thread Starter [joeey1984](https://wordpress.org/support/users/joeey1984/)
 * (@joeey1984)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/problem-adding-a-wrong-url/#post-5216086)
 * Thank you for your prompt reply.
 * Have a great day.
 *  Thread Starter [joeey1984](https://wordpress.org/support/users/joeey1984/)
 * (@joeey1984)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/problem-adding-a-wrong-url/#post-5216087)
 * Hello again, I tired the codes. Everything is fine except when the image container
   remains blank and preview is clicked , the add photo button comes up and you 
   can post a blank page again.
 * Meanwhile regarding the image click play. I found this code and modified it. 
   Basically what it does is it looks for [bpfb_video\] video tag and converts to
   youtube’s specific thumb. There are two downfalls, one is that the code is only
   for youtube, and two the the code only works when the youtube link along with[
   bpfb_video\] tag is posted on the activity page as text . For example,
 * This on the activity page:
 * [bpfb_video]http://www.youtube.com/watch?v=f1GJF9ocdj4g[/bpfb_video]
 * And this somewhere in the plugin
 *  jQuery(document).ready(function(a){var b=/\[bpfb_video\]https?:\/\/(?:www\.)?
   youtu(?:be\.com|\.be)\/(?:watch\?v=|v\/)?([A-Za-z0-9_\-]+)([a-zA-Z&=;_+0-9*#\-]*?)\[\/
   bpfb_video\]/;
    var c='<div data-address=”$1″ class=”youtube” style=”background:
   url([http://i4.ytimg.com/vi/$1/hqdefault.jpg](http://i4.ytimg.com/vi/$1/hqdefault.jpg))”
   ><span></span></div>’;var d='<iframe data-address=”$1″ class=”youtube” src=”[http://www.youtube.com/embed/$1?enablejsapi=1&hd=1&autohide=1&autoplay=1&#8243](http://www.youtube.com/embed/$1?enablejsapi=1&hd=1&autohide=1&autoplay=1&#8243);
   frameborder=”0″ allowfullscreen></iframe>’;a(“.activity-inner”).each(function(){
   var d=a(this);d.html(d.html().replace(b,c))});a(“.activity-inner”).delegate(“
   div.youtube”,”click”,function(){var b=a(this);b.replaceWith(d.replace(/\$1/g,
   b.attr(“data-address”)))})})
 *  Plugin Support [Predrag – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support1/)
 * (@wpmudev-support1)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/problem-adding-a-wrong-url/#post-5216102)
 * Hi Joseph,
 * > Everything is fine except when the image container remains blank and preview
   > is clicked , the add photo button comes up and you can post a blank page again.
 * It’s working fine on my test site.
 * Could you please share me your activity page link with enabling registration 
   on your site so that i can troubleshoot the issue?
 * > Meanwhile regarding the image click play. I found this code and modified it.
   > Basically what it does is it looks for [bpfb_video\] video tag and converts
   > to youtube’s specific thumb. There are two downfalls, one is that the code 
   > is only for youtube, and two the the code only works when the youtube link 
   > along with [bpfb_video\] tag is posted on the activity page as text .
 * Thanks for sharing the solution in the community. It will help others looking
   for the similar solution.
 * As it is not formatted in your reply, i will format it as following so that it
   will be easier for others to copy.
 * For example,
 * This on the activity page:
 *     ```
       [bpfb_video]http://www.youtube.com/watch?v=f1GJF9ocdj4g[/bpfb_video]
       ```
   
 * And this somewhere in the plugin
 *     ```
       jQuery(document).ready(function(a){var b=/\[bpfb_video\]https?:\/\/(?:www\.)?youtu(?:be\.com|\.be)\/(?:watch\?v=|v\/)?([A-Za-z0-9_\-]+)([a-zA-Z&=;_+0-9*#\-]*?)\[\/bpfb_video\]/;
       var c='<div data-address="$1" class="youtube" style="background: url(http://i4.ytimg.com/vi/$1/hqdefault.jpg)"><span></span></div>';var d='<iframe data-address="$1" class="youtube" src="http://www.youtube.com/embed/$1?enablejsapi=1&hd=1&autohide=1&autoplay=1" frameborder="0" allowfullscreen></iframe>';a(".activity-inner").each(function(){var d=a(this);d.html(d.html().replace(b,c))});a(".activity-inner").delegate("div.youtube","click",function(){var b=a(this);b.replaceWith(d.replace(/\$1/g,b.attr("data-address")))})})
       ```
   
 * Cheers,
    WPMU DEV

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Problem adding a wrong url..’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/buddypress-activity-plus_db6c43.svg)
 * [BuddyPress Activity Plus](https://wordpress.org/plugins/buddypress-activity-plus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/buddypress-activity-plus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/buddypress-activity-plus/)
 * [Active Topics](https://wordpress.org/support/plugin/buddypress-activity-plus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/buddypress-activity-plus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/buddypress-activity-plus/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Predrag – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support1/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/problem-adding-a-wrong-url/#post-5216102)
 * Status: not resolved