I use Membership Pro and Edocman along with Easy Profile on my site (I also use Payment Form and Events Booking on different sites – you make great products!!). I’m close to finding a way to automatically assign individual Edocman documents to new members (not groups) when registering and automatically allowing/restricting access to individual documents both in Edocman and on their Easy Profile page based on conditions...I just can’t figure out the last part of code.
I use the Membership Pro registration form and map fields to Easy Profile. The problem I have is that as part of a member’s subscription, they choose multiple Edocman documents when registering. The documents don’t have specific relation to their subscription plan or assigned Joomla group so I can't auto-assign ownership based on group/plan. So after registration, we have to manually add each user ID in the backend as an additional owner of each document after they register. With hundreds of documents and hundreds of users this does not work well.
To automate the process, I created a multi-select list in Membership Pro on the registration form which is mapped to a matching multi-select list in Easy Profile. Easy Profile allows database queries to populate the multi-select options so in my multi-select list the options are directly populated by #_edocman_documents as:
Value|Text =
Edocman ID of document|Edocman title of document
I then created a separate custom field in Easy Profile to map the array values of the selected options (Edocman IDs). I added PHP code to trigger the Edocman content plugin and also added additional code to show thumbnails, etc. Now when users select documents from the multi-select list, the document titles, thumbnails, and download links are generated automatically for each user and shown on their profile page.
There are two problems. First, although the download link is auto-generated, in order for the user to actually download the document, they still need ownership access individually assigned through Edocman. Second, I would like users to also automatically have access to individual documents in Edocman itself when they register, not just their profile page in Easy Profile.
To do this I would like to trigger the update of the Edocman “user_ids” database field to add the new member ID when the documents are selected from the Easy Profile select list so they can download it. Since Easy Profile and Edocman both use Joomla ID it shouldn’t be too complicated, but I haven’t been able to figure out the actual code for this. Can you help me with the language? The matching database for both info is below. Thanks for the great products and great support!!
Edocman
Table: “#_edocman_table”
Column: “user_ids” (Joomla IDs of the owners)
Row: “id” (Document ID)
Easy Profile
Table: “#_jsn_users”
Column: “id” (Joomla user ID)
Column: “select_field” (select field)
Value of “select_field”: ["1","2","3","4","5"] (Edocman Document IDs which are retuned as the “value” of “value|text” in the select field)
When a user registers or updates profile in Easy Profile, I would like to map the values from Easy Profile “id” column to Edocman “user_ids” column where Easy Profile “select_field” column values = Edocman “id” row values