I am building an online forum with EasyDiscuss.

In a social login component, I am able to get user avatars from Facebook/Google. Now I want to save these avatars to EasyDiscuss users. EasyDiscuss has some methods like ED::updateProfile($id,$data), I think I'd better use it.

This raises a question, once I get the avatar from within the social login component, how can I call this method to save the avatar?

In other words, how do I interact with a component from within another component?

It seems to me require_once('/components/com_easydiscuss/easydiscuss.php') is good enough. Is it?

1 Answer 1


It is doubtful it may work; and even if it did, you risk other issues. Components often use constants and loaders that would not work outside the component itself, such as JPATH_COMPONENT.

I see the main risk in the assets, which will be created by Joomla referencing your calling component (the social login component) instead of the called component (Easy Discuss).

That said, if you're just planning to update the avatar, and nothing more, most likely no assets would need to be created, hence it is worth a try. If you can require it, invoke the static method and get the avatar to save, you're fine.

You might want to run a diff on the database before and after the call, to ensure no other unexpected changes took place.

A more reliable approach would be invoking the component through its controller with a proper POST, which could be delivered with an ajax call or through direct navigation.

Both of the above require time and effort. The third way is a quick and dirty solution: most likely all that saving the avatar require is storing the image file and making a database UPDATE. You might save yourself a lot of time doing just that from the Social Login component.

  • Thanks. Saving avatar in Easy Discuss also triggers some other events like increasing user point, that is why I was thinking to call the method. Nonetheless, directly modifying the database is definitely worth trying. I am also thinking about saving the avatar as custom fields to Joomla user profile, and it shouldn't be hard to get this field from within EasyDiscuss, do you think it is feasable?
    – shenkwen
    Commented Jan 19, 2021 at 23:32
  • I would suggest to limit the number of extensions interacting at 2, the more you add, the more maintenance issues you may face in the future. But it is feasible. Commented Jan 21, 2021 at 18:03

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.