[Skip to main content](#vessel-content)

#   User variables and affiliate program

##

- **[emergentec](/forum/user/949-emergentec "View emergentec's Profile")**
- [![emergentec's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/949-emergentec "View emergentec's Profile") Topic Author
- [ Offline](/forum/user/949-emergentec)

Less More

- Posts: 137
- Thank you received: 2
-
-

15 years 8 months ago [\#10823](#10823) by [emergentec](/forum/user/949-emergentec "View emergentec's Profile")  *[User variables and affiliate program](/forum/4-how-to/10823-user-variables-and-affiliate-program#10823 "Hi!  We use the Hikashop-Variables in a Joomla-User-Plugin which triggers on &quot;onUserLogin&quot; with $user&#95;id =&amp; hikashop::loadUser();  It works fine, but if we deactivate the Hikashop-plugin affiliate program the Joomla-plugin doesn't work anymore, because the plugin can't load the hikashop userID. Why?  Best regards")* was created by *[emergentec](/forum/user/949-emergentec "View emergentec's Profile")*

Hi!

We use the Hikashop-Variables in a Joomla-User-Plugin which triggers on "onUserLogin" with $user_id =&amp; hikashop::loadUser();

It works fine, but if we deactivate the Hikashop-plugin affiliate program the Joomla-plugin doesn't work anymore, because the plugin can't load the hikashop userID. Why?

Best regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzEwODIzLXVzZXItdmFyaWFibGVzLWFuZC1hZmZpbGlhdGUtcHJvZ3JhbT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 8 months ago [\#10847](#10847) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: User variables and affiliate program](/forum/4-how-to/10823-user-variables-and-affiliate-program#10847 "Hi!  We use the Hikashop-Variables in a Joomla-User-Plugin which triggers on &quot;onUserLogin&quot; with $user&#95;id =&amp; hikashop::loadUser();  It works fine, but if we deactivate the Hikashop-plugin affiliate program the Joomla-plugin doesn't work anymore, because the plugin can't load the hikashop userID. Why?  Best regards")*

Hi,

Right after the loggin of the user, it's possible that the session is not yet initialized for the user. Please make sure that the ordering of your plugin is greater than the joomla user plugin so that the session of the user is initialized before your plugin is triggered by joomla.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzEwODIzLXVzZXItdmFyaWFibGVzLWFuZC1hZmZpbGlhdGUtcHJvZ3JhbT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[emergentec](/forum/user/949-emergentec "View emergentec's Profile")**
- [![emergentec's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/949-emergentec "View emergentec's Profile") Topic Author
- [ Offline](/forum/user/949-emergentec)

Less More

- Posts: 137
- Thank you received: 2
-
-

15 years 8 months ago [\#10943](#10943) by [emergentec](/forum/user/949-emergentec "View emergentec's Profile")  Replied by *[emergentec](/forum/user/949-emergentec "View emergentec's Profile")* on topic *[Re: User variables and affiliate program](/forum/4-how-to/10823-user-variables-and-affiliate-program#10943 "Hi!  We use the Hikashop-Variables in a Joomla-User-Plugin which triggers on &quot;onUserLogin&quot; with $user&#95;id =&amp; hikashop::loadUser();  It works fine, but if we deactivate the Hikashop-plugin affiliate program the Joomla-plugin doesn't work anymore, because the plugin can't load the hikashop userID. Why?  Best regards")*

**nicolas wrote:**

> Hi,
>
> Right after the loggin of the user, it's possible that the session is not yet initialized for the user. Please make sure that the ordering of your plugin is greater than the joomla user plugin so that the session of the user is initialized before your plugin is triggered by joomla.

My plugin has ordering 9 and joomla user plugin has 0 and it still doesn't work. What has the status of the affiliate plugin to do with the status of the session?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzEwODIzLXVzZXItdmFyaWFibGVzLWFuZC1hZmZpbGlhdGUtcHJvZ3JhbT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 8 months ago [\#10954](#10954) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: User variables and affiliate program](/forum/4-how-to/10823-user-variables-and-affiliate-program#10954 "Hi!  We use the Hikashop-Variables in a Joomla-User-Plugin which triggers on &quot;onUserLogin&quot; with $user&#95;id =&amp; hikashop::loadUser();  It works fine, but if we deactivate the Hikashop-plugin affiliate program the Joomla-plugin doesn't work anymore, because the plugin can't load the hikashop userID. Why?  Best regards")*

The affiliate plugin initialize the hikashop framework when loaded. If you deactivate it, the hikashop framework might not be loaded before and you should load it yourself in your plugin if you need to use a funtion from hikashop like the hikashop::loadUser() function. For that you can use the line below before your code:
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzEwODIzLXVzZXItdmFyaWFibGVzLWFuZC1hZmZpbGlhdGUtcHJvZ3JhbT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.051 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
