Link taxonomy terms associated to a content with the user profile field

Created on 2 June 2014, over 10 years ago
Updated 19 March 2023, over 1 year ago

I have a taxonomy called "Interest". Also I have added a field called "I_am_interested_in" in the profile2 as term reference to the taxonomy "Interest". Then I created a content type called "Profession" which also has a field term reference to the taxonomy "Interest".
Now I want to have an image link right next to the every content title of the content type Profession. When an authenticated user clicks on the link, the taxonomy term associated with the content should be added to the user's "I_am_interested_in" field.

What I did: I have an ajax in page.tpl.php(attached) file in such a way that when a user clicks on the link, it goes to the a new page called ajaxcall.php(attached). Ajaxcall.php does all the database operation with a new db connection.

But I know this approach is not a proper way to do(though it works functionality wise). Please suggest whether I should create a module for this or whatever that is proper. How do I start with creating module for this?
Thanks in advance!

📌 Task
Status

Active

Component

Code

Created by

🇮🇳India subz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024