I'd like to gather some basics on how to make community plugins. I'm an experienced PHP developer, but after following JomSocial's
documentation for creating community plugins
, I was lost.
This is my first time creating a plugin for Joomla!, and I'm running Joomla! 3.3.1 and JomSocial 3.2.0.6. If you refer to the attached screenshot, I was able to make a slightly-modified version of the "example" plugin from the documentation, but you'll notice in the red-boxed area, my plugin's title is "PLG_SPONSORS_TITLE".
My sponsors.xml has:
<languages>
<language tag="en-GB">en-GB.plg_community_sponsors.ini</language>
<language tag="en-GB">en-GB.plg_community_sponsors.sys.ini</language>
</languages>PLG_SPONSORS_TITLE="This needs a title"
Hi, Enrico.
I assign developer to this thread.
Hi Enrico,
Can you try to put file en-GB.plg_community_sponsors.ini and en-GB.plg_community_sponsors.sys.ini to administrator language folder, please? because we check the lang file from the administrator folder.
If this method still now working, I need your FTP access to inspect this issue further.
thank you
Thanks for your reply Dimas,
I have updated my post details for FTP access. I tried uploading my languages files in the administrator folder, but the issue still persists. You'll see that my plugin was uploaded to plugins/community/sponsors. Please have a look.
Hi Enrico,
Thank you for the FTP access, but you didnt provide me the backend access, can you also provide it please?
thank you
Hi Enrico,
Can you try to put file en-GB.plg_community_sponsors.ini and en-GB.plg_community_sponsors.sys.ini to administrator language folder, please? because we check the lang file from the administrator folder.
If this method still now working, I need your FTP access to inspect this issue further.
thank you
Dimas Tekad Santosa wrote: Hi Enrico,
Thank you for the FTP access, but you didnt provide me the backend access, can you also provide it please?
thank you
Hi Enrico,
Can you check again, please? should work fine now.. I added this code :
CAppPlugins::loadLanguage( 'plg_community_' . $plgObjWrapper->getPluginName() , JPATH_ADMINISTRATOR );
That's a very obscure solution, but it worked. Thank you.
When I edit my sponsors.php page, I'd like to be able to use more names from my language file such as PLG_SPONSORS_NEW ("Add a Sponsor!"). Using these defined names doesn't work. In my file, I have:
sponsors.php From line 122
//create a slot for an extra sponsor and if user is logged in
$usr = JFactory::getUser();
$usrID = $usr->id;
//print("Logged in: ".$usrID." Profile: " . $id);
if ($c < 5 && $usrID === $id) {
$sponsors .= '
<div class="newSponsor">
<a title="'.PLG_SPONSORS_NEW.'" href="javascript:cWindowShow(\'Hello World\', \'Create Referral URL\')">
+
</a>
</div>
';
}
$content = str_replace('@replace', $sponsors, $content);
return $content;
Hi Enrico,
You need to use this code :
JText::_('PLG_SPONSORS_NEW')Thank you for your help. I think it would be beneficial to others to update the documentation to include all these tips and code modifications.