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

#   dynamic user access

##

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

Less More

- Posts: 28
- Thank you received: 1
-
-

3 years 11 months ago [\#347750](#347750) by [highstat@highstat.com](/forum/user/70596-highstat-highstat-com "View highstat@highstat.com's Profile")  *[dynamic user access](/forum/33-customers/905583-dynamic-user-access#347750 "-- HikaShop version -- : 4.7.0 -- Joomla version -- : 4.latest -- PHP version -- : 8.1  Hello, With your help, I managed to create a plugin that prints user information on each page of an e-book(s) via onBeforeDownloadFile.  In onBeforeDownloadFile, I take the user's email and other user info, add this information to each page of a pdf (using the Setas package), and create a new pdf file. The user can then download this new pdf file. This is called social digital rights management (social DRM). The idea is that when people see their name on each page of an E-book, they will think twice before uploading it to share with the rest of the world. From a coding point of view, it all works perfectly. Thanks for your help.  Now I want to add something extra. A university library may buy 10 of our E-books. If that happens, then I would like to implement the following.  1. A librarian purchases our package via hikashop. 2. The librarian gets an invoice, order number and an email with a download link. 3. The idea is that the librarian makes the order number available on their internal catalog, plus a link to our website. In specific to our 'Customer download space' menu item. 4. Now there are potentially hundreds of students from that library who want to download our e-books. But instead of the user info from the librarian, I want to add the email address of the student to each page of each pdf.  My question is now as follows. Once a student logs into the 'Customer download space' (using the login info from the librarian)....how can I now collect information from the student and pass that on into onBeforeDownloadFile? To be more specific, before they click on the download button, I need to grab their email address via a pop-up message and pass this into onBeforeDownloadFile so that I can grab it there, and create a new pdf again.  Where would I do this? Or is there any other way of doing this? Or should I go the Joomla usergroup route?  So..in short....the purchased product is associated to a specific client and I need to give hundreds of other people access to it. But I want to extract information from the original purchaser and from hundreds of students to an existing pdf.  Kind regards,  Alain")* was created by *[highstat@highstat.com](/forum/user/70596-highstat-highstat-com "View highstat@highstat.com's Profile")*

-- HikaShop version -- : 4.7.0
-- Joomla version -- : 4.latest
-- PHP version -- : 8.1

Hello,
With your help, I managed to create a plugin that prints user information on each page of an e-book(s) via onBeforeDownloadFile.

In onBeforeDownloadFile, I take the user's email and other user info, add this information to each page of a pdf (using the Setas package), and create a new pdf file. The user can then download this new pdf file. This is called social digital rights management (social DRM). The idea is that when people see their name on each page of an E-book, they will think twice before uploading it to share with the rest of the world. From a coding point of view, it all works perfectly. Thanks for your help.

Now I want to add something extra. A university library may buy 10 of our E-books. If that happens, then I would like to implement the following.

1. A librarian purchases our package via hikashop.
2. The librarian gets an invoice, order number and an email with a download link.
3. The idea is that the librarian makes the order number available on their internal catalog, plus a link to our website. In specific to our 'Customer download space' menu item.
4. Now there are potentially hundreds of students from that library who want to download our e-books. But instead of the user info from the librarian, I want to add the email address of the student to each page of each pdf.

My question is now as follows. Once a student logs into the 'Customer download space' (using the login info from the librarian)....how can I now collect information from the student and pass that on into onBeforeDownloadFile? To be more specific, before they click on the download button, I need to grab their email address via a pop-up message and pass this into onBeforeDownloadFile so that I can grab it there, and create a new pdf again.

Where would I do this? Or is there any other way of doing this? Or should I go the Joomla usergroup route?

So..in short....the purchased product is associated to a specific client and I need to give hundreds of other people access to it. But I want to extract information from the original purchaser and from hundreds of students to an existing pdf.

Kind regards,

Alain

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy85MDU1ODMtZHluYW1pYy11c2VyLWFjY2Vzcz90bXBsPW1hcmtkb3du) 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: 86584
- Thank you received: 14325
-
-

3 years 11 months ago [\#347755](#347755) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[dynamic user access](/forum/33-customers/905583-dynamic-user-access#347755 "-- HikaShop version -- : 4.7.0 -- Joomla version -- : 4.latest -- PHP version -- : 8.1  Hello, With your help, I managed to create a plugin that prints user information on each page of an e-book(s) via onBeforeDownloadFile.  In onBeforeDownloadFile, I take the user's email and other user info, add this information to each page of a pdf (using the Setas package), and create a new pdf file. The user can then download this new pdf file. This is called social digital rights management (social DRM). The idea is that when people see their name on each page of an E-book, they will think twice before uploading it to share with the rest of the world. From a coding point of view, it all works perfectly. Thanks for your help.  Now I want to add something extra. A university library may buy 10 of our E-books. If that happens, then I would like to implement the following.  1. A librarian purchases our package via hikashop. 2. The librarian gets an invoice, order number and an email with a download link. 3. The idea is that the librarian makes the order number available on their internal catalog, plus a link to our website. In specific to our 'Customer download space' menu item. 4. Now there are potentially hundreds of students from that library who want to download our e-books. But instead of the user info from the librarian, I want to add the email address of the student to each page of each pdf.  My question is now as follows. Once a student logs into the 'Customer download space' (using the login info from the librarian)....how can I now collect information from the student and pass that on into onBeforeDownloadFile? To be more specific, before they click on the download button, I need to grab their email address via a pop-up message and pass this into onBeforeDownloadFile so that I can grab it there, and create a new pdf again.  Where would I do this? Or is there any other way of doing this? Or should I go the Joomla usergroup route?  So..in short....the purchased product is associated to a specific client and I need to give hundreds of other people access to it. But I want to extract information from the original purchaser and from hundreds of students to an existing pdf.  Kind regards,  Alain")*

Hi,

In that case, I would recommend you add a controller and a view in the plugin where you have your onBeforeDownloadFile.
You can do that basing yourself on the plugin in plugins/hikashop/email_history/
This plugin implements the event onHikashopPluginController to add its own controller to HikaShop and a file email_history_ctrl.php to handle the tasks. Then, in its views folder, it has views to display stuff. This plugin is the one responsible for the Customers&gt;Emails history menu in the backend of HikaShop. It does everything in there without any code in HikaShop specific to that function. So it's a good starting point to add extra stuff to HikaShop.
You would have one task in your controller which would display a view. That view would have a form where the user could enter his information and submit. The action of the form would point at the download URL of the order with extra parameters in the URL so that you could get them in the onBeforeDownloadFile event to generate the PDF accordingly.

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

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