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

#   User Group after Purchase

##

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago -  13 years 9 months ago [\#88249](#88249) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#88249 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")* was created by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")*

I am trying to ensure users are added to a specific user group after purchase. I have "User Group After Purchase" set to "custom" "athlete" group

but it does not seem to activate as seen here ("registered" but not "Athlete"):

[ ![Screen&#95;Shot&#95;2013-01-30&#95;at&#95;5&#95;21&#95;48&#95;PM.png](/forum/attachment/8313) ](/forum/attachment/8313 "...5&#95;21&#95;48&#95;PM.png")

- [ ![Screen&#95;Shot&#95;2013-01-30&#95;at&#95;5&#95;21&#95;48&#95;PM.png](/forum/attachment/8313) ](/forum/attachment/8313 "...5&#95;21&#95;48&#95;PM.png") [ ](/forum/attachment/8313?download=1 "...5&#95;21&#95;48&#95;PM.png")

Last edit: 13 years 9 months ago by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile").

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

13 years 9 months ago [\#88275](#88275) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#88275 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Hi,

Did the order been validated (confirmed) ?

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#88316](#88316) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#88316 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

No I understand. So that is the issue. We have users complete payment via authorize.net or paypal.

They are then directed back to our site to setup their profile and attend to other matters. This is only possible for them via a specific user group which (despite completing payment) has not been stored in their current session.

Is my only alternative to ask them to log out and log back in again in order to have that user groups' privileges?

Many thanks

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 9 months ago [\#88394](#88394) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#88394 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Hi,

They don't have to log out and then log in, when the order is confirmed, the group will automatically be added on their account.
Just refreshing the page should be ok.

You can too change the default order status in the checkout configuration.

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#88779](#88779) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#88779 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Ok testing now in 2.1.0

1. once the order is "confirmed" the user group is applied however
2. the modules which are to be visible are not seen by that user (newly confirmed) unless they log out / log in.

Is there a work around?

example:
1. go here:
[ 184.154.228.9/~throwdow/live/index.php?o...ent&amp;id=10&amp;Itemid=118](http://184.154.228.9/~throwdow/live/index.php?option=com_ohanah&view=event&id=10&Itemid=118)
2. click buy tickets and create a dummy account (real email address)
3. complete the free "transaction" you will be marked "confirmed" on our backend
4. click "your account" top right.. notice there are no modules displayed (they should be based on your new user group)
5. log out and log in and click "your account" and the modules are there.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzc3OTc2LXVzZXItZ3JvdXAtYWZ0ZXItcHVyY2hhc2U/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14326
-
-

13 years 9 months ago [\#88973](#88973) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#88973 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Hi,

I see what you mean.
Unfortunately, the process confirming the orders and thus adding the user group is a server to server process where the payment gateway directly contacts HikaShop to notify HikaShop of the payment. So the user session is not available in that process and the "user group after purchase" plugin which is triggered when the order is confirmed is not able to change the user session at that time.

The best we can add is to force the logout of the user by deleting the session information from the database if you're using the database as session handler (there is an option to select that in the configuration of joomla).

To do that, you can add the code: Code:

else{ //auto logout user on the frontend $conf = JFactory::getConfig(); $handler = $conf-&gt;get('session_handler', 'none'); if($handler=='database'){ $db-&gt;setQuery('DELETE FROM '.hikashop_table('session',false).' WHERE client_id=0 AND userid = '.(int)$data-&gt;user_cms_id); $db-&gt;query(); } }

after the code: Code:

if($no_change){ if($mainframe-&gt;isAdmin()){ $mainframe-&gt;enqueueMessage('The customer of that order is already in the good user group','notice'); } return true; }

in the file plugins/hikashop/group/group.php

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago -  13 years 9 months ago [\#89146](#89146) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89146 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Thank you. Looks good. The only snag I now run into is for free events like here:

[ wodrocket.com/index.php?option=com\_hikas...emo-winter-throwdown](http://wodrocket.com/index.php?option=com_hikashop&ctrl=product&task=show&cid=1&name=demo-winter-throwdown)

Despite being logged out, the user still looks to be logged in, which is confusing to the user because the confirm language now says "Thank you for your purchase. Please login above to update your athlete profile."

But "above" looks like they are already logged in. If they were to refresh the page, they would notice the login form.

Last edit: 13 years 9 months ago by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzc3OTc2LXVzZXItZ3JvdXAtYWZ0ZXItcHVyY2hhc2U/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14326
-
-

13 years 9 months ago [\#89208](#89208) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89208 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Well, the problem is that the user group is added on the same page as the display of that page when you use the validate free orders plugin. So it is still logged in when displaying the login module.
That will require additional code after that code to remove the session data in the session if the current session is for the user of the order.

Add the code Code:

if(!$mainframe-&gt;isAdmin()){ $user = JFactory::getUser(); if($user-&gt;id==$data-&gt;user_cms_id){ $session = JFactory::getSession(); $session-&gt;set('user', new JUser($data-&gt;user_cms_id)); } }

after the code: Code:

if($handler=='database'){ $db-&gt;setQuery('DELETE FROM '.hikashop_table('session',false).' WHERE client_id=0 AND userid = '.(int)$data-&gt;user_cms_id); $db-&gt;query(); }

in that same file and that should solve the issue.

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#89236](#89236) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89236 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Hmm.

After creating new account and completing purchase, it still shows user as logged in (even though they are not) as evidenced by refreshing screen.

I have attached the screenshot. Many thanks.

- [ ![Screen&#95;Shot&#95;2013-02-08&#95;at&#95;1&#95;49&#95;38&#95;PM.png](/forum/attachment/8452) ](/forum/attachment/8452 "...1&#95;49&#95;38&#95;PM.png") [ ](/forum/attachment/8452?download=1 "...1&#95;49&#95;38&#95;PM.png")

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#89237](#89237) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89237 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Almost like the code needs to simply say.. before displaying "thank you for your purchase...",
refresh screen.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzc3OTc2LXVzZXItZ3JvdXAtYWZ0ZXItcHVyY2hhc2U/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14326
-
-

13 years 9 months ago [\#89357](#89357) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89357 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Mmm. I don't have any other idea. that code should work.

For the message, you can change it with a translation override:
[ www.hikashop.com/en/download/languages.html#modify](http://www.hikashop.com/en/download/languages.html#modify)

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#89363](#89363) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89363 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Ok. Let me try again. Was I supposed to add the code from #88973 or no?

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 9 months ago [\#89441](#89441) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89441 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Hi,

Yes you was supposed to.

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#89477](#89477) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89477 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Ok. Included both snippets of code. Works for paid events where we leave the server / site and return. Still does not work for free events where user does not leave site.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzc3OTc2LXVzZXItZ3JvdXAtYWZ0ZXItcHVyY2hhc2U/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14326
-
-

13 years 9 months ago -  13 years 9 months ago [\#89761](#89761) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89761 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Ok, try with that code instead then: Code:

if(!$mainframe-&gt;isAdmin()){ $mainframe-&gt;logout( $data-&gt;user_cms_id ); }

Last edit: 13 years 9 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#89852](#89852) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89852 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

sorry getting this error:

Parse error: syntax error, unexpected '}' in /home/throwdow/public_html/live/plugins/hikashop/group/group.php on line 94

I have included the entire group.php file

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 9 months ago [\#89895](#89895) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89895 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Try to replace the content with: Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 2.1.0 * @author hikashop.com * @copyright (C) 2010-2012 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;?php class plgHikashopGroup extends JPlugin { function plgHikashopGroup(&amp;$subject, $config){ parent::__construct($subject, $config); } function onProductDisplay(&amp;$product,&amp;$html){ ob_start(); ?&gt;&lt;fieldset class="adminform"&gt; &lt;legend&gt;&lt;?php echo JText::_('USER_GROUP_AFTER_PURCHASE'); ?&gt;&lt;/legend&gt; &lt;?php $subscriptiontype = hikashop_get('type.subscription'); echo $subscriptiontype-&gt;display('product_group_after_purchase',@$product-&gt;product_group_after_purchase,'product'); ?&gt; &lt;/fieldset&gt;&lt;?php $html[]=ob_get_clean(); } function onAfterOrderCreate( &amp;$order,&amp;$send_email){ return $this-&gt;onAfterOrderUpdate( $order,$send_email); } function onAfterOrderUpdate(&amp;$order,&amp;$send_email){ $config=&amp;hikashop_config(); $confirmed = $config-&gt;get('order_confirmed_status'); if(!isset($order-&gt;order_status)) return true; $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); $class = hikashop_get('class.order'); $dbOrder = $class-&gt;get($order-&gt;order_id); $class = hikashop_get('class.user'); $data = $class-&gt;get($dbOrder-&gt;order_user_id); if(empty($data-&gt;user_cms_id)){ if($mainframe-&gt;isAdmin()){ $mainframe-&gt;enqueueMessage('The customer '.$dbOrder-&gt;order_user_id.'does not have a joomla user account so his group cannot be changed','notice'); } return true; } $db-&gt;setQuery('SELECT b.*,a.* FROM &#96;#__hikashop_order_product&#96; as a LEFT JOIN &#96;#__hikashop_product&#96; as b ON a.product_id=b.product_id WHERE a.order_id = '.(int) $dbOrder-&gt;order_id.' AND b.product_group_after_purchase!=\'\''); $allProducts = $db-&gt;loadObjectList(); if(empty($allProducts)){ return true; } if($order-&gt;order_status!=$confirmed){ return true; } $no_change=true; foreach($allProducts as $oneProduct){ if(hikashop_isAllowed($oneProduct-&gt;product_group_after_purchase,$data-&gt;user_cms_id)){ continue; } $no_change=false; $this-&gt;_updateGroup($data-&gt;user_cms_id,$oneProduct-&gt;product_group_after_purchase); if($mainframe-&gt;isAdmin()){ $mainframe-&gt;enqueueMessage('The user '.$dbOrder-&gt;order_user_id.' is now in the group '.$oneProduct-&gt;product_group_after_purchase); } } if($no_change){ if($mainframe-&gt;isAdmin()){ $mainframe-&gt;enqueueMessage('The customer of that order is already in the good user group','notice'); } return true; } else{ //auto logout user on the frontend $conf = JFactory::getConfig(); $handler = $conf-&gt;get('session_handler', 'none'); if($handler=='database'){ $db-&gt;setQuery('DELETE FROM '.hikashop_table('session',false).' WHERE client_id=0 AND userid = '.(int)$data-&gt;user_cms_id); $db-&gt;query(); } if(!$mainframe-&gt;isAdmin()){ $mainframe-&gt;logout( $data-&gt;user_cms_id ) } } } function _updateGroup($user_id,$new_group_id,$remove_group_id=0){ $user = clone(JFactory::getUser($user_id)); if(version_compare(JVERSION,'1.6.0','&lt;')){ if($user-&gt;gid!=25){ $user-&gt;set('gid',$new_group_id); $acl = JFactory::getACL(); $user-&gt;set('usertype', $acl-&gt;get_group_name($new_group_id)); } }else{ jimport('joomla.access.access'); $userGroups = JAccess::getGroupsByUser($user_id, true); $userGroups[] = $new_group_id; if(!empty($remove_group_id)){ $key = array_search($remove_group_id, $userGroups); if(is_int($key)){ unset($userGroups[$key]); } } $user-&gt;set('groups',$userGroups); } $user-&gt;save(); } }

Two "}" were missing.

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#89924](#89924) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89924 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

sorry still getting the following error when I try to access hikashop from the back-end:

Parse error: syntax error, unexpected '}' in /home/throwdow/public_html/live/plugins/hikashop/group/group.php on line 93

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 9 months ago [\#89987](#89987) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#89987 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Add a ";" at the end of the line 92.

Regards

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

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

Less More

- Posts: 241
- Thank you received: 5
-
-

13 years 9 months ago [\#90348](#90348) by [cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")  Replied by *[cberry1971](/forum/user/13211-cberry1971 "View cberry1971's Profile")* on topic *[User Group after Purchase](/forum/4-how-to/77976-user-group-after-purchase#90348 "I am trying to ensure users are added to a specific user group after purchase. I have &quot;User Group After Purchase&quot; set to &quot;custom&quot; &quot;athlete&quot; group  but it does not seem to activate as seen here (&quot;registered&quot; but not &quot;Athlete&quot;):")*

Ok. getting there.

Works on paid products. On free products we are getting the following error:

"No class of content is loaded! To avoid critical error, proccess aborted"

To create the issue go here:

[ 184.154.228.9/~throwdow/live/index.php?o...ent&amp;id=10&amp;Itemid=118](http://184.154.228.9/~throwdow/live/index.php?option=com_ohanah&view=event&id=10&Itemid=118)

complete registration and purchase (free). Again purchases which are not free work fine.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzc3OTc2LXVzZXItZ3JvdXAtYWZ0ZXItcHVyY2hhc2U/dG1wbD1tYXJrZG93bg==) 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.098 seconds

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