1. fmpmanager
  2. General
  3. Wednesday, December 17 2014, 12:05 AM
Hello. I'm currently using this excellent extension to develop a custom site for an acting troop. So far, I am enjoying this FAR MORE than any of the other community extensions (paid and free). :D

The troop leader likes the Youtube video field, but as actors they use a variety of media sources (including Vine, Vimeo, etc.). I don't mind writing plugins and such. How would I go about writing a plugin to accommodate this? Is there documentation? Or should I just study the Youtube plugin and take it from there.

Thanks!
admin Accepted Answer
Admin
Hi,
the best way(even the most simple) is to extend this functionality to video field type.

to do this you must change 2 files: 1) Rule to accept other URL (like vimeo or vine) and 2) Output

1) Rule
open file /administrator/com_jsn/models/rule/video.php
in this file is present a validation of URL. You can see at line 97 the validation for youtube path
example for Vimeo
change line 97 from
if(!(strpos(' '.$value,'https://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'https://m.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://youtu.be/')==1)) return false;

to
if(!(strpos(' '.$value,'https://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'https://m.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://youtu.be/')==1 || strpos(' '.$value,'http://vimeo.com/')==1 || strpos(' '.$value,'https://vimeo.com/')==1)) return false;


2) Output
open file /administrator/com_jsn/helpers/fields/video.php
at line 82 you will find a function "video", this function set output of video field
example for Vimeo
add this code before line 91 (see screenshot)
if(strpos(' '.$value,'vimeo')>1)
{
$value=substr($value,strrpos($value,'/')+1);
return '<iframe src="//http://player.vimeo.com/video/'.$value.'?portrait=0&badge=0" width="500" height="209" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
}



In future we will add many other providers.;)

NOTE: this code is not supported and will be delete when you update Easy Profile.
Attachments (1)
  1. more than a month ago
  2. General
  3. # 1
fmpmanager Accepted Answer
Content Protected
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
but how do I develop entire plugins?
We are preparing the documentation to create plugins to display on the profile page and to create custom field types. unfortunately still not available sorry :(
  1. more than a month ago
  2. General
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.