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
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

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: 10015
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: 10015
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

cron