User recognition and script insertion

Andrea Ted Posted in Technical Support 2 years ago

Hello everybody. I am trying to insert a script for user recognition by automatically sending the data to a dashboard. I inserted the script inside the themes / white / plugins / default / pages / contents / index.php page, but I have problems:
1) using the native function of ossn $ getuser I can't get the user's user id (maybe because the page where I inserted the script doesn't foresee the user reading)
2) I can't find which page I need to use to find the info I need (id, guid, name, etc.).
Could you give me some advice?
Thank you

us Michieal ~ Coder ~ Replied 2 years ago

I would emphasize what Michael said. Emphasis on the link; you never want to modify core files, themes, core components - as these will change every time there's an update. It will get old very quickly trying to remember every place that you made a change in them, so that you can replicate those changes.
I understand that it "sounds logical" to just insert your code into the existing files, but from a design standpoint it is not maintainable and will create many headaches for you.

Never modify the index.php, because you can, and often will, bring your entire site down by doing so. If you make it a component, if something breaks, you can turn the component off, and have a working site again while you try to figure out where it went wrong.

that said, if there is a repository that can be looked at, or you put stuff here, we can help and point out where the issue is. I recommend using a repository like github, as it makes it so much simpler.

The index page is to set everything up. Once that is done and the system is loaded up, initialized and ready to go, you will then have access to functions, like ossn_loggedin_user(); which will return the user object with the info that you need.

Also, while it's not exactly outdated, this link is also very helpful: as it shows you most of the built in functions, classes, etc. You will need this information for "what do I put into the component" once you get started.

German Michael Z├╝lsdorff Replied 2 years ago

I'd recommend

  1. to study the developer documentation, starting with
  2. create and upload a component with your recognition code

This is the easiest way to help us understand what you're trying to achieve and resolve the still missing parts.