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

#   How To Create Coupon From Username At Registration

##

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

Less More

- Posts: 27
- Thank you received: 0
-
-

7 years 7 months ago [\#306058](#306058) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  *[How To Create Coupon From Username At Registration](/forum/46-discount-coupon/897364-how-to-create-coupon-from-username-at-registration#306058 "Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?  So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37  Is there any way to do this?")* was created by *[workspace](/forum/user/58281-workspace "View workspace's Profile")*

Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?

So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37

Is there any way to do this?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTczNjQtaG93LXRvLWNyZWF0ZS1jb3Vwb24tZnJvbS11c2VybmFtZS1hdC1yZWdpc3RyYXRpb24/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: 86592
- Thank you received: 14333
-
-

7 years 7 months ago [\#306079](#306079) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How To Create Coupon From Username At Registration](/forum/46-discount-coupon/897364-how-to-create-coupon-from-username-at-registration#306079 "Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?  So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37  Is there any way to do this?")*

Hi,

Yes. You can do that with AcyMailing and the tag integration we have with it.
With AcyMailing, you can configure it to send an email automatically after the user registration. And in that email, you can use the HikaShop coupon tag to generate a HikaShop coupon and replace the tag in the email by the code of the coupon:
[ www.acyba.com/acymailing/161-acymailing-...hikashop.html#coupon](https://www.acyba.com/acymailing/161-acymailing-plugin-hikashop.html#coupon)

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

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

Less More

- Posts: 27
- Thank you received: 0
-
-

7 years 7 months ago [\#306081](#306081) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  Replied by *[workspace](/forum/user/58281-workspace "View workspace's Profile")* on topic *[How To Create Coupon From Username At Registration](/forum/46-discount-coupon/897364-how-to-create-coupon-from-username-at-registration#306081 "Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?  So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37  Is there any way to do this?")*

Would this require the registration to be done via AcyMailing?

And would the coupon be able to be their username? I can't seem to see username in the code variables?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTczNjQtaG93LXRvLWNyZWF0ZS1jb3Vwb24tZnJvbS11c2VybmFtZS1hdC1yZWdpc3RyYXRpb24/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: 86592
- Thank you received: 14333
-
-

7 years 7 months ago [\#306085](#306085) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How To Create Coupon From Username At Registration](/forum/46-discount-coupon/897364-how-to-create-coupon-from-username-at-registration#306085 "Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?  So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37  Is there any way to do this?")*

Hi,

No, it will work with the registration done through Joomla or HikaShop's registration forms (AcyMailing doesn't have a registration form).

Regarding the username, I checked in the code of the plugin and it doesn't support it.
It would require some code modification to the acymailing-hikashop integration to support it.
In the file plugins/acymailing/hikashop/hikashop.php you can find this line which replaces the tags: Code:

$code = str_replace(array('[name]', '[clean_name]', '[subid]', '[email]', '[key]', '[flat]', '[percent]', '[value]', '[prodid]'), array($user-&gt;name, $clean_name, $user-&gt;subid, $user-&gt;email, $key, $flat_amount, $percent_amount, $value, $product_id), $code);

Unfortunately, $user doesn't contain the information of the username and so to handle it would require loading the user with a MySQL query and then do the replacement. It's possible but it will require some development.

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

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

Less More

- Posts: 27
- Thank you received: 0
-
-

7 years 7 months ago [\#306111](#306111) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  Replied by *[workspace](/forum/user/58281-workspace "View workspace's Profile")* on topic *[How To Create Coupon From Username At Registration](/forum/46-discount-coupon/897364-how-to-create-coupon-from-username-at-registration#306111 "Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?  So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37  Is there any way to do this?")*

What about instead of creating a plugin to do all this, couldn't there just be a line of code added to the registration that inserts the username entered into the MySQL table for the discounts?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTczNjQtaG93LXRvLWNyZWF0ZS1jb3Vwb24tZnJvbS11c2VybmFtZS1hdC1yZWdpc3RyYXRpb24/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: 86592
- Thank you received: 14333
-
-

7 years 7 months ago [\#306124](#306124) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How To Create Coupon From Username At Registration](/forum/46-discount-coupon/897364-how-to-create-coupon-from-username-at-registration#306124 "Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?  So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37  Is there any way to do this?")*

Hi,

That could be a solution yes.
Here is some documentation on how to create a Joomla plugin for the registration:
[ www.informit.com/articles/article.aspx?p=1858258&amp;seqNum=5](http://www.informit.com/articles/article.aspx?p=1858258&seqNum=5)
This is compatible with HikaShop's registration too.
Then, in the plugin, you can do that MySQL query to insert the coupon in the hikashop_coupon table.

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

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

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

Less More

- Posts: 27
- Thank you received: 0
-
-

7 years 7 months ago [\#306128](#306128) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  Replied by *[workspace](/forum/user/58281-workspace "View workspace's Profile")* on topic *[How To Create Coupon From Username At Registration](/forum/46-discount-coupon/897364-how-to-create-coupon-from-username-at-registration#306128 "Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?  So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37  Is there any way to do this?")*

Thank you, I have succeeded with this by adding some PHP to the registration.php file that when the user registers it adds the username as a coupon. However I will definitely look into your link and learn to make a plugin as that is a more preferred method than having to put code in the core files. Thank you for that.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTczNjQtaG93LXRvLWNyZWF0ZS1jb3Vwb24tZnJvbS11c2VybmFtZS1hdC1yZWdpc3RyYXRpb24/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.094 seconds

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