× Joomla Facebook Connect support forum

Topic-icon Writing my own profile plugin

11 years 4 months ago #29124 by chramb1
I use the jomsocial and kunena profile plugins that you provide. I'd like to write my own to do some more field imports into my own components. Looking at the code for yours, it's pretty straightforward.

If I clone, say, the jomsocial plugin and re-code the "meat" to do my own work, is there anything else I need to do? Clearly I'll give it a unique name and install it as a plugin. Does that handle the discovery? What about configuration values? For example, this line in the jomsocial plugin:

$defaultType = $this->configModel->getSetting('profiles_jomsocial_profiletype_default', 0);

Where is profiles_jomsocial_profiletype_default created? I see where it's edited in configuration.php in the plugin, but how are configuration values created and linked up?

Many thanks!
The topic has been locked.
Support Specialist
11 years 4 months ago #29134 by alzander
Christopher,
Glad the code is pretty straightforward. In our opinions, it's actually really hideous :) When we first started the profile plugins (2 years ago), they were really short and easy to create. With time, and more extensions we integrated with, they got pretty nasty looking. In the next few months, we'll be overhauling the system to make profile plugins easier to create (for us and users) and reduce some common bugs that happen across the board.

Anyways.. with that said, if you haven't already, you may want to check out our pretty outdated Profile Plugins for JFBConnect guide. It is outdated, but has some of the concepts written down. Some functions have changed though, so it may confuse you more :)

As for your specific questions:
* Clone and change names is the right way to go. JFBConnect doesn't 'expect' any profile plugins, so you can create one and JFBConnect will just see it like any others.
* The variables are created magically. We handle that. Just replace profiles_xyz_ with whatever you want. There are a few variables you should always define, even if they aren't 'settable':
import_avatar
import_always
field_map
Those are expected to be 'set' by JFBConnect for each plugin. Any other variables you create are for your use only within the plugin, but you can create as many as you want.

Hope that helps explain, but if you have any questions, we'll help how we can!

Thanks,
Alex
The topic has been locked.
11 years 4 months ago #29140 by chramb1
Beautiful. Done.

One question that I didn't see an immediate answer is with respect to jfbcImportConnections() - can I omit this entirely? Or must I implement it empty?
The topic has been locked.
Support Specialist
11 years 4 months ago #29141 by alzander
Skip it. That's if you have an extension (like JomSocial) that already had Facebook integration. That function would let you implement some code to copy any existing user-mappings to JFBConnect.

Glad to hear you're going so quickly. Should you have any other questions, just let us know!

Finally, if you haven't already, please consider leaving a rating and review on the Joomla Extension Directory for JFBConnect, or our support. It's certainly not required, but very appreciated:
extensions.joomla.org/extensions/social-...ook-integration/7215

Thanks, and good luck,
Alex
The topic has been locked.