4

I'm working on a tricky User plugin that needs to do certain things only if being called from a 3rd party component. I could check the option in the url, but I need to consider that the user may be added by way of a 3rd party using MVC and and the model directly, not necessarily with a link FOR that 3rd party component.

Is there a way to determine this?

Update: Ancient problem, but was still haunting me, so if of any interest to anyone, I created a Logging class that can track where updates of this nature are done, and save the data and parameters involved for later review. Its freely available at JSE Github.

1

You can check the Itemid in the url. If there is no Itemid, you should create at least a hidden menu item for the 3rd party registration page. The Itemid of the menu can be obtained manually (admin area -> menu):

enter image description here

or by some codes inside your plugin:

$app = JFactory::getApplication();
$item_id = $app->input->get('Itemid');

$menu = $app->getMenu();
$items = $menu->getItems('component', 'com_3rd_party');

foreach ($items as $item)
{
    if ($item->id == $item_id)
    {
        echo 'This is 3rd party!';
    }
}
  • This assumes that an AJAX call uses an itemid - sorry, no dice. – GDP Nov 11 '14 at 14:15
1

I suppose you could try using the onUserAfterSave (Documentation Ref) plugin event that will get triggered when a user record is update or when a new user is added. With this plugin event comes the $isnew boolean argument. true is when a new record is added.

Hope this helps

  • That's actually the event i'm working with - i want to differentiate between additions from the admin backend, a 3rd party social component, and our component. – GDP Nov 11 '14 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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