1

I try to have the plugin working to have a email/password only on the registration form. Joomla Registration: Remove unneeded fields

I install the plugin correctly with XML below:

<extension version="3.1" type="plugin" group="user">
    <name>plg_simple_registration</name>
    <description>PLG_SIMPLE_REGISTRATION_XML_DESCRIPTION</description>
    <files>
        <filename plugin="SimpleRegistration">PlgUserSimpleRegistration.php</filename>
    </files>

But, the plugin is enabled in the backend but never launched. -> Is it about the group?

I try the have the form name printed but it never show

    class PlgUserSimpleRegistration extends JPlugin
{
    function onContentPrepareForm($form, $data)
    {
        $name = $form->getName();
        echo "<h2>Simple Registration" .  $name . "</h2>";

I try another plugin 'Regauth' and it works great. I don't see any issue on the SimpleRegistration plugin.

1

1 Answer 1

3

I finally found the answer

class PlgUserSimpleRegistration extends JPlugin

change "Plg" with "plg"

class plgUserSimpleRegistration extends JPlugin

It's working now

3
  • This appears to be just another way that Joomla branches away from PHP's PSR coding standards Or is this perhaps the symptom of something else that is incorrect in your project? Commented Aug 18, 2021 at 22:38
  • 1
    I think your XMLIs not Joomla like.Here you see a Camelcase Name in Joomla: github.com/joomla/joomla-cms/blob/…. Here is the line in XML <filename plugin="profile">profile.php</filename> (github.com/joomla/joomla-cms/blob/…)
    – astridx
    Commented Aug 19, 2021 at 5:39
  • 1
    @Jeremy Sanglier - as in the above comments, you had incorrectly given the name of the plugin in the XML file (missing the plugin group). It should be: <name>plg_user_simpleregistration</name> and the plugin class name should be: class PlgUserSimpleregistration
    – Zollie
    Commented Aug 19, 2021 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.