Subject: Access API with fixed user (instead of deriving the user from the session)
How do I access the UNB API as if by coming from a fixed user id, bypassing the session/cookie stuff that normally happens?
I am trying to integrate UNB with a newspaper website, where I would like a forum thread for each news article.
The newspaper website shows an article with a PHP script, so I augmented that script to invoke UNB API functions to find the right forum and the right thread within that forum and to output a link to that thread beneath the article. I also added code to auto-create the forum threads (using IThread.Add and IPost.Add, mostly).
So far, so good. But now it turns out that the new thread and post are added using the credentials of the user sitting in front of the browser (if that user has logged into UNB yet). But that's not what I want. I want these auto-created threads and posts to be always from the same user.
But the human sitting in front of the browser should still be allowed to click on a link to the thread, and be authenticated with their own credentials or by their own browser session. This way, replies added by that person would come from them.
I started reading through the stuff that comes after the session.prelogin hook in common.lib.php, but it made my head swim.
Thanks,
Kai
I am trying to integrate UNB with a newspaper website, where I would like a forum thread for each news article.
The newspaper website shows an article with a PHP script, so I augmented that script to invoke UNB API functions to find the right forum and the right thread within that forum and to output a link to that thread beneath the article. I also added code to auto-create the forum threads (using IThread.Add and IPost.Add, mostly).
So far, so good. But now it turns out that the new thread and post are added using the credentials of the user sitting in front of the browser (if that user has logged into UNB yet). But that's not what I want. I want these auto-created threads and posts to be always from the same user.
But the human sitting in front of the browser should still be allowed to click on a link to the thread, and be authenticated with their own credentials or by their own browser session. This way, replies added by that person would come from them.
I started reading through the stuff that comes after the session.prelogin hook in common.lib.php, but it made my head swim.
Thanks,
Kai

kaig
Show profile
Link to this post