OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Using static pages to display additional database content

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Using static pages to display additional database content

Postby PatickC » Tue Jan 22, 2013 4:57 pm

Hi,

I've searched throughout the forum for an answer and so far haven't found anything that's helped me.
I am trying to use static pages to display information to users, but only certain users with permissions that I would set manually.
So I would add a field in the database with the permissions, but I can't find how to access the current user's information (for example his username, so I can use that to connect to the database and check his permission). Basically, I'm trying to understand where the username for the current session gets stored. Hope this makes sense.

Patrick
PatickC
 
Posts: 5
Joined: Tue Jan 08, 2013 8:58 pm

Re: Using static pages to display additional database conten

Postby asmecher » Wed Jan 23, 2013 10:06 am

Hi Patrick,

The Static Pages plugin won't be able to help you with that; you'll either need to write a new plugin, or modify the code directly. Once you're into PHP-land, you can get the current user by calling the Request::getUser() function, which will return a User object. Then you can use $user->getUsername() to get the username.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm

Re: Using static pages to display additional database conten

Postby PatickC » Wed Jan 23, 2013 7:27 pm

Thank you Alec,

I had assumed it wouldn't be as easy as it seemed in my mind. I've decided to go another route to get what I need done, but I am curious if there's documentation on how to get to PHP-land as you call it.

Thanks,
Patrick
PatickC
 
Posts: 5
Joined: Tue Jan 08, 2013 8:58 pm

Re: Using static pages to display additional database conten

Postby asmecher » Wed Jan 23, 2013 9:44 pm

Hi Patrick,

The best reference on that is the Technical Reference, available from our Documentation page, though it's a little out of date; I also turned up this article by an outside contributor.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm


Return to OCS Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest