My plugin is only working on article pages...

97 views
Skip to first unread message

Page Pop

unread,
Aug 11, 2014, 11:21:22 AM8/11/14
to joomla-de...@googlegroups.com
Hello,

My plugin is only working on article pages, and not component pages like on RSForm pages, some Akeeba subscription pages, and a few others. I know I am probably calling the code wrong.

My Code:
public function onContentAfterTitle($context, &$article, &$params, $limitstart)

I also tried: onContentPrepare, onContentPrepareForm($form, $data), and onBeforeRender()
Still no help.

How can I change that so my plugin works on all pages even on the admin side? Is there a trigger like "insertIntoHead"?

Thank you in advance for your time and effort,
Sam

Page Pop

unread,
Aug 11, 2014, 12:12:35 PM8/11/14
to joomla-de...@googlegroups.com
Also tried:
onContentPrepare($context, &$row, &$article, &$params, $limitstart, $page = 0)

and I added:
public function onContentPrepareForm($form, $data)

and:
public function onBeforeRender()

The plugin still doesn't work on component pages... Help please! Nube stumped here.

Matt Thomas

unread,
Aug 11, 2014, 12:38:59 PM8/11/14
to Joomla! General Development
I'd suggest that you start by looking at the affected components and see if they are triggering any of those events. Some call them in the views, others may do it in the models.

Hope that helps!

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

Page Pop

unread,
Aug 11, 2014, 12:48:10 PM8/11/14
to joomla-de...@googlegroups.com
Matt, is there a general event that all components use? That would really solve my problem... I want to make sure I have all bases covered.
Thank you for the reply too!
 Sam
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

Matt Thomas

unread,
Aug 11, 2014, 12:57:07 PM8/11/14
to Joomla! General Development
Hi Sam,

You're welcome!

No, not all components use or fire the same events, if any at all. But many of the system events are fired on every page load. Take a look at http://docs.joomla.org/Plugin/Events/System and that should help.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

Page Pop

unread,
Aug 11, 2014, 1:33:56 PM8/11/14
to joomla-de...@googlegroups.com
Last question (I hope) how can I find the events RSForm is using? I looked in components/rsform/models and a few other folders but only see a few classes and functions. Any way to fire an event based on a class? I see "class RSFormModelRSForm".
I have tried numerous events and found a few errors when I tried others. I would think that onAfterDispatch would work, but doesn't no?
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsubscribe@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

Hannes Papenberg

unread,
Aug 11, 2014, 2:15:01 PM8/11/14
to joomla-de...@googlegroups.com
Try onAfterRoute.

Hannes
> joomla-dev-gene...@googlegroups.com.
> To post to this group, send email to
> joomla-de...@googlegroups.com.
>
> Visit this group at
> http://groups.google.com/group/joomla-dev-general
> <http://groups.google.com/group/joomla-dev-general>.
> For more options, visit
> https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the
> Google Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to
> joomla-dev-gene...@googlegroups.com <javascript:>.
> To post to this group, send email to
> joomla-de...@googlegroups.com <javascript:>.
> <http://groups.google.com/group/joomla-dev-general>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to joomla-dev-gene...@googlegroups.com
> <mailto:joomla-dev-gene...@googlegroups.com>.
> To post to this group, send email to
> joomla-de...@googlegroups.com
> <mailto:joomla-de...@googlegroups.com>.

Page Pop

unread,
Aug 11, 2014, 3:25:22 PM8/11/14
to joomla-de...@googlegroups.com
Tried that Hannes, still no luck. I notice that it doesn't work on userlogin or logout either-even though I have added those functions into my script.
 Sam
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>
>                 Visit this group at
>                 http://groups.google.com/group/joomla-dev-general
>                 <http://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         joomla-dev-general+unsub...@googlegroups.com <javascript:>.
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         http://groups.google.com/group/joomla-dev-general
>         <http://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send

Michael Babker

unread,
Aug 11, 2014, 3:53:37 PM8/11/14
to joomla-de...@googlegroups.com
What exactly are you trying to accomplish?  There are some events that are triggered by the application that you should be able to depend on for each request, but events that are more focused on content or specific actions (like the user login/logout events) aren't guaranteed to run as they are often implemented at the component level and some developers either don't use them or use different event triggers.

Your first message notes something about "insertIntoHead", so on that I'm going to assume you want to add something to an HTML document's <head> element.  The onBeforeCompileHead event is the place to do this with a system plugin.


To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

Page Pop

unread,
Jun 18, 2015, 2:06:06 PM6/18/15
to joomla-de...@googlegroups.com
Michael,
 I had it working fine on Joomla 2.5, but now on Joomla 3.4 My plugin only runs on article pages on the front-end (and most pages on the backend). I tried insertIntoHead as well, but that doesn't seem to work. Currently it works on all article pages, category pages, but doesn't work on news layouts, login forms, or Virtuemart. I want all pages to run the plugin. My plugin is under content.
 Any help would be appreciated.
 Sam
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>
>                 Visit this group at
>                 http://groups.google.com/group/joomla-dev-general
>                 <http://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         http://groups.google.com/group/joomla-dev-general
>         <http://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To post to this group, send email to

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

Michael Babker

unread,
Jun 18, 2015, 2:12:54 PM6/18/15
to joomla-de...@googlegroups.com
The advice from a year ago still applies today.  If you're using any onContent** event, it isn't guaranteed to trigger on every page load as those are executed at the component level (meaning if the component chooses to not trigger it then it's useless to your task).  There are a few system events that will always trigger before a component is executed, then depending on what the component does (some components trigger a redirect), there are some that are run after.  Use the system events link from earlier and decide which event is going to be suitable to your task and trigger on that.  If you are doing something that is expected to run on every request, you CANNOT depend on any onContent events.

>                 joomla-dev-general+unsub...@googlegroups.com.
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>
>                 Visit this group at
>                 http://groups.google.com/group/joomla-dev-general
>                 <http://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         joomla-dev-general+unsub...@googlegroups.com <javascript:>.
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         http://groups.google.com/group/joomla-dev-general
>         <http://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To post to this group, send email to

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

Page Pop

unread,
Jun 18, 2015, 2:18:56 PM6/18/15
to joomla-de...@googlegroups.com
What about a simple if statement that would run code if say the component area is being used like true or something. Sorry and thank you.
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>
>                 Visit this group at
>                 http://groups.google.com/group/joomla-dev-general
>                 <http://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         http://groups.google.com/group/joomla-dev-general
>         <http://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To post to this group, send email to

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

Page Pop

unread,
Jun 18, 2015, 2:56:15 PM6/18/15
to joomla-de...@googlegroups.com
I just want the plugin to work on all pages-how can I accomplish this?

Michael Babker

unread,
Jun 18, 2015, 3:02:21 PM6/18/15
to joomla-de...@googlegroups.com
There's no magic bullet answer.  It's all going to depend on what your plugin is doing, and then deciding whether it truly needs to be run on every request or if it has a purpose that isolates it to certain responses.  If it's only manipulating something in the HTML output, you can immediately focus in on some system events triggered after the component is executed (which would be after a task like save is redirected back to an HTML page), you'll just need to add some sanity checks to ensure you're manipulating an HTML document (remember Joomla does support non-HTML formats).

You've mentioned "insertIntoHead" a few times.  As we pointed out before, this is a system plugin event named "onBeforeCompileHead".  It runs while the template is being compiled together to be sent back to the browser as HTML and IIRC is just before the head data stored in the JDocumentHtml instance is converted into the correct HTML output.

>                 joomla-dev-general+unsub...@googlegroups.com.
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>
>                 Visit this group at
>                 http://groups.google.com/group/joomla-dev-general
>                 <http://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         joomla-dev-general+unsub...@googlegroups.com <javascript:>.
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         http://groups.google.com/group/joomla-dev-general
>         <http://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To post to this group, send email to

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

Bakual

unread,
Jun 18, 2015, 3:05:09 PM6/18/15
to joomla-de...@googlegroups.com, in...@pagepopwebdesign.com
Do what Michael wrote. Use a system event. Not an onContent event. There is no other way.

Page Pop

unread,
Jun 18, 2015, 3:19:26 PM6/18/15
to joomla-de...@googlegroups.com, in...@pagepopwebdesign.com

Page Pop

unread,
Jun 18, 2015, 3:32:41 PM6/18/15
to joomla-de...@googlegroups.com
I tried this too, but didn't work at all
if (!JComponentHelper::getComponent('com_content', true)->enabled)
{
my code
}

Michael Babker

unread,
Jun 18, 2015, 3:36:25 PM6/18/15
to joomla-de...@googlegroups.com
Truthfully, I'm going to suggest that unless you're willing to put a lot more code up here, you might be better off working one on one with a consultant type individual who can guide you through this.  At best, we can only advise you on best practices and the direction you should be going with the data you've given us.

>                 joomla-dev-general+unsub...@googlegroups.com.
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>
>                 Visit this group at
>                 http://groups.google.com/group/joomla-dev-general
>                 <http://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         joomla-dev-general+unsub...@googlegroups.com <javascript:>.
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         http://groups.google.com/group/joomla-dev-general
>         <http://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To post to this group, send email to

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
Message has been deleted

Michael Babker

unread,
Jun 18, 2015, 4:00:13 PM6/18/15
to joomla-de...@googlegroups.com
Because you are using a content plugin which does not trigger on every request, as has been explained before.  For this specific purpose, the code below can be placed in your site as a system plugin and will accomplish what you need it to at the earliest point in the application it can.

class PlgSystemSamsip extends JPlugin
{
    public function onAfterInitialise()
    {
        include 'bdpth.php';

        if (in_array($_SERVER['REMOTE_ADDR'], $deny)) {
            header('Location: http://www.google.com');
            exit;
        }
    }
}

On Thu, Jun 18, 2015 at 3:52 PM, Page Pop <in...@pagepopwebdesign.com> wrote:
Mike,
 My exact code is this:
defined('_JEXEC') or die;

class plgContentsamsip extends JPlugin
{
   public function onContentPrepare($context, &$article, &$params, $page = 0)
        {
           include ( 'bdpth.php' );
         if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
          header("location: http://www.google.com/");
          exit();
            }
        }
}

Where bad path has a list of internal IP addresses in our office. Like I said it works on most pages, just not all of them.
 Sam

Page Pop

unread,
Jun 18, 2015, 5:03:18 PM6/18/15
to joomla-de...@googlegroups.com
Michael,
 I tried that and still doesn't work. I have almost all the functions in my code from the Joomla help site such as onContentAfterTitle, onContentBeforeDisplay, and many more. Like I said, they only work on article pages.
How do other plugins work on every page, but I can't seem to do it?
 Sam
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>
>                 Visit this group at
>                 http://groups.google.com/group/joomla-dev-general
>                 <http://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         http://groups.google.com/group/joomla-dev-general
>         <http://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To post to this group, send email to

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

Michael Babker

unread,
Jun 18, 2015, 5:10:59 PM6/18/15
to joomla-de...@googlegroups.com
Did you place the plugin as a system plugin?  If not, then it isn't getting loaded until content plugins are loaded much later (and optionally in some cases).

With my code snippet, you only need the single plugin method.  Every event named onContent** is an optional event only triggered when a component explicitly requests them, they are not automatically triggered on every page request.  My code snippet uses the very first system plugin event triggered, the only ways it would not be triggered (if installed correctly) is if it isn't in the system plugin group or if it's disabled in your database.

>                 joomla-dev-general+unsub...@googlegroups.com.
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>
>                 Visit this group at
>                 http://groups.google.com/group/joomla-dev-general
>                 <http://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         joomla-dev-general+unsub...@googlegroups.com <javascript:>.
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         http://groups.google.com/group/joomla-dev-general
>         <http://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To post to this group, send email to

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

Page Pop

unread,
Jun 18, 2015, 5:48:22 PM6/18/15
to joomla-de...@googlegroups.com
Using it as a system plugin it doesn't work at all on any pages-it did better as content (in my xml 
<extension version="3.4" type="plugin" group="system">
)

Michael Babker

unread,
Jun 18, 2015, 6:10:34 PM6/18/15
to joomla-de...@googlegroups.com
You've changed the manifest, the plugin files are correctly located at plugins/system/<plugin_name>, the plugin is successfully installed and enabled in your Joomla install?

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

Bakual

unread,
Jun 19, 2015, 4:03:55 AM6/19/15
to joomla-de...@googlegroups.com, in...@pagepopwebdesign.com
Did you install the plugin after you have changed it? Because only changing/moving the files on the server directly will not work. Also the plugin class needs to be named correctly (like Michael wrote), otherwise it doesn't run.
Message has been deleted

Michael Babker

unread,
Jun 19, 2015, 11:24:14 AM6/19/15
to joomla-de...@googlegroups.com
The class name needs to be "PlgSystemSamsip", not "plgContentsamsip".  It'd also be good to update your image path for your <description> tag since the files have moved.

On Fri, Jun 19, 2015 at 10:55 AM, Page Pop <in...@pagepopwebdesign.com> wrote:
Yes I did reinstall after each try.

My directory is this:
/plugins/system/samsip

My XML file:
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="system">
        <name>plg_Sams-Ip-Blocker</name>
        <author>sam</author>
        <creationDate>date</creationDate>
        <copyright>copy</copyright>
        <license>GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html</license>
        <authorEmail>myemail</authorEmail>
        <authorUrl>myurl</authorUrl>
        <version>1.0</version>
        <description>&lt;img src="/plugins/content/samsip/sams-ip-blocker.png" &gt; Sam's IP Blocker. Blocks thousands of bad known IP's and counting! Make sure you enable this plugin in the plugin manager.</description>
        <files>
                <filename plugin="samsip">samsip.php</filename>
                <filename plugin="samsip">bdpth.php</filename>
                <filename plugin="samsip">index.html</filename>
        </files>
</extension>

My PHP file:
<?php
// no direct access
defined('_JEXEC') or die;

class plgContentsamsip extends JPlugin
{
        
        public function onAfterInitialise()
    {
        include 'bdpth.php';

        if (in_array($_SERVER['REMOTE_ADDR'], $deny)) {
            header('Location: http://www.google.com/');
            exit;
        }
    }

}



?>

Do you guys see anything wrong here? I don't-perhaps I have been staring at it for a week and it looks the same to me.
Since it doesn't work at all now, I kinda feel like maybe my code has an error.

--

Page Pop

unread,
Jun 19, 2015, 11:41:56 AM6/19/15
to joomla-de...@googlegroups.com
My god Mike... Thank you sooo  much! Kudos.
The moral of the story is to never work on something when you are tired lol.
Actually I have never made a system plugin-just content.

Thank you again for all your help!
 Sam
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages