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

#   \[PLUGIN\] Send a form through onAfterUserCreate

##

- **[Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")**
- [![Fit&#95;webmaster's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile") Topic Author
- [ Offline](/forum/user/33004-fit-webmaster)

Less More

- Posts: 6
- Thank you received: 0
-
-

12 years 5 months ago -  12 years 5 months ago [\#159740](#159740) by [Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")  *[\[PLUGIN\] Send a form through onAfterUserCreate](/forum/32-content-creation/868914-plugin-send-a-form-through-onafterusercreate#159740 "-- url of the page with the problem -- : Localhost -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.3.0 -- PHP version -- : 5.5.10 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : There is no error message, it just dont send the email.  Hi guys,  I am trying to auto send a form once the user register in Hikashop.  I have create this plugin and place it inside root/plugins/hikashop/hikaforce.  here is the function  class plgHikashopHikaforce extends JPlugin {  function onAfterUserCreate(&amp;$element){  } I also have put it inside a variable called $output and return it... did not work either.  What am I doing wrong.  Thanks in advance")* was created by *[Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")*

-- url of the page with the problem -- : Localhost
-- HikaShop version -- : 2.3.0
-- Joomla version -- : 3.3.0
-- PHP version -- : 5.5.10
-- Browser(s) name and version -- : All
-- Error-message(debug-mod must be tuned on) -- : There is no error message, it just dont send the email.

Hi guys,

I am trying to auto send a form once the user register in Hikashop.

I have create this plugin and place it inside root/plugins/hikashop/hikaforce.

here is the function

class plgHikashopHikaforce extends JPlugin
{

function onAfterUserCreate(&amp;$element){

This commented bit is for testing and it works fine. it does redirect to this file and send submit the form as I desire.

// $link = JURI::root()."plugins/hikashop/hikaforce/redirect\_data.php";
// $msg = 'Testing Redirect';
// $app = JFactory::getApplication();
// $app-&gt;redirect($link, $msg);

However if I try to echo inside the function onAfterUserCreate it does not send.
echo '&lt;form id="force" name="force" action="[ www.example.com](http://www.example.com)" method="POST"&gt;';
echo '&lt;input type=hidden name="code" value="LP\_WEB" &gt;';
echo '&lt;input type=hidden name="first\_name" value="first\_name"&gt;';
echo '&lt;input type=hidden name="last\_name" value="last\_name"&gt;';
echo '&lt;/form&gt;';
echo '&lt;script type="text/javascript"&gt;';
echo 'document.getElementById("force").submit();';
echo '&lt;/script&gt;';

}
I also have put it inside a variable called $output and return it... did not work either.

What am I doing wrong.

Thanks in advance

Last edit: 12 years 5 months ago by [Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile").

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

- **[Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")**
- [![Fit&#95;webmaster's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile") Topic Author
- [ Offline](/forum/user/33004-fit-webmaster)

Less More

- Posts: 6
- Thank you received: 0
-
-

12 years 5 months ago [\#159836](#159836) by [Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")  Replied by *[Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")* on topic *[\[PLUGIN\] Send a form through onAfterUserCreate](/forum/32-content-creation/868914-plugin-send-a-form-through-onafterusercreate#159836 "-- url of the page with the problem -- : Localhost -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.3.0 -- PHP version -- : 5.5.10 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : There is no error message, it just dont send the email.  Hi guys,  I am trying to auto send a form once the user register in Hikashop.  I have create this plugin and place it inside root/plugins/hikashop/hikaforce.  here is the function  class plgHikashopHikaforce extends JPlugin {  function onAfterUserCreate(&amp;$element){  } I also have put it inside a variable called $output and return it... did not work either.  What am I doing wrong.  Thanks in advance")*

Anyone?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY4OTE0LXBsdWdpbi1zZW5kLWEtZm9ybS10aHJvdWdoLW9uYWZ0ZXJ1c2VyY3JlYXRlP3RtcGw9bWFya2Rvd24=) 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)
-

12 years 5 months ago [\#159858](#159858) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[\[PLUGIN\] Send a form through onAfterUserCreate](/forum/32-content-creation/868914-plugin-send-a-form-through-onafterusercreate#159858 "-- url of the page with the problem -- : Localhost -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.3.0 -- PHP version -- : 5.5.10 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : There is no error message, it just dont send the email.  Hi guys,  I am trying to auto send a form once the user register in Hikashop.  I have create this plugin and place it inside root/plugins/hikashop/hikaforce.  here is the function  class plgHikashopHikaforce extends JPlugin {  function onAfterUserCreate(&amp;$element){  } I also have put it inside a variable called $output and return it... did not work either.  What am I doing wrong.  Thanks in advance")*

Hi,

When doing an echo, it is not displayed because there is no views, it's just an action which should be made.
In your code, there is missing double quotes around the "hidden" word for the inputs.

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

- **[Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")**
- [![Fit&#95;webmaster's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile") Topic Author
- [ Offline](/forum/user/33004-fit-webmaster)

Less More

- Posts: 6
- Thank you received: 0
-
-

12 years 5 months ago -  12 years 5 months ago [\#159995](#159995) by [Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")  Replied by *[Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")* on topic *[\[PLUGIN\] Send a form through onAfterUserCreate](/forum/32-content-creation/868914-plugin-send-a-form-through-onafterusercreate#159995 "-- url of the page with the problem -- : Localhost -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.3.0 -- PHP version -- : 5.5.10 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : There is no error message, it just dont send the email.  Hi guys,  I am trying to auto send a form once the user register in Hikashop.  I have create this plugin and place it inside root/plugins/hikashop/hikaforce.  here is the function  class plgHikashopHikaforce extends JPlugin {  function onAfterUserCreate(&amp;$element){  } I also have put it inside a variable called $output and return it... did not work either.  What am I doing wrong.  Thanks in advance")*

I have added those quotes to it and it did not work... so I have changed quite a bit the code... I am very close to it... just need to know how to retrieve the data from #__hikashop_address..

Here is the code:

$query = "SELECT * FROM #__hikashop_address WHERE address_user_id = ".$element-&gt;user_cms_id;
$db-&gt;setQuery($query);
$result = $db-&gt;loadObjectList();

---

I will work on it now, but would be great to get some response.

---

foreach ($result as $r){
echo $r-&gt;xyz
}

OR

How can I get the data from the form? like last name, postcode, city, telephone so on?
$element-&gt;city ??

Cheers Xavier

Last edit: 12 years 5 months ago by [Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY4OTE0LXBsdWdpbi1zZW5kLWEtZm9ybS10aHJvdWdoLW9uYWZ0ZXJ1c2VyY3JlYXRlP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

12 years 5 months ago [\#159998](#159998) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[\[PLUGIN\] Send a form through onAfterUserCreate](/forum/32-content-creation/868914-plugin-send-a-form-through-onafterusercreate#159998 "-- url of the page with the problem -- : Localhost -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.3.0 -- PHP version -- : 5.5.10 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : There is no error message, it just dont send the email.  Hi guys,  I am trying to auto send a form once the user register in Hikashop.  I have create this plugin and place it inside root/plugins/hikashop/hikaforce.  here is the function  class plgHikashopHikaforce extends JPlugin {  function onAfterUserCreate(&amp;$element){  } I also have put it inside a variable called $output and return it... did not work either.  What am I doing wrong.  Thanks in advance")*

Try like that instead:
$query = "SELECT * FROM #__hikashop_address WHERE address_user_id = ".$element-&gt;user_id;
$db-&gt;setQuery($query);
$result = $db-&gt;loadObjectList();

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

- **[Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")**
- [![Fit&#95;webmaster's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile") Topic Author
- [ Offline](/forum/user/33004-fit-webmaster)

Less More

- Posts: 6
- Thank you received: 0
-
-

12 years 4 months ago [\#160331](#160331) by [Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")  Replied by *[Fit\_webmaster](/forum/user/33004-fit-webmaster "View Fit&#95;webmaster's Profile")* on topic *[\[PLUGIN\] Send a form through onAfterUserCreate](/forum/32-content-creation/868914-plugin-send-a-form-through-onafterusercreate#160331 "-- url of the page with the problem -- : Localhost -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.3.0 -- PHP version -- : 5.5.10 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : There is no error message, it just dont send the email.  Hi guys,  I am trying to auto send a form once the user register in Hikashop.  I have create this plugin and place it inside root/plugins/hikashop/hikaforce.  here is the function  class plgHikashopHikaforce extends JPlugin {  function onAfterUserCreate(&amp;$element){  } I also have put it inside a variable called $output and return it... did not work either.  What am I doing wrong.  Thanks in advance")*

Got this... Xavier [HikaShop] helped me.
The problem was that when using onAfterUserCreate the Address array is not yet created. Once I changed my trigger method to onAfterAddressCreate I could echo Address and pull the user instead.
Thanks

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

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