5 users online. Create an account or sign in to join them.Users

Announcement

Symphony's issue tracker has been moved to Github.

Issues are displayed here for reference only and cannot be created or edited.

Browse

Closed#599: Cannot get Author or IsDeveloper() with Frontend class in use.

I am not sure why it is like that. I wanted field to check if user is Developer, and only then allow to change value of field. It works on administration pages, using Symphony::Engine(), but it does not work when viewing frontend page (using section_schemas) - it crashes page :(.

Anyone knows why it is like that? I thought that maybe Frontend class does not have $Author initialized, so i tried calling isLoggedIn() first (which should set up $Author variable), but it did not help.

Can you post the code that you are using?

This works for me in the Frontend context (grab function of a Datasource).

if(Frontend::instance()->Author instanceof Author && Frontend::instance()->Author->isDeveloper()) {
    // do Developer code
}
else {
    // user is not a Symphony Author or is not a Developer
}

I was modifying incrementnumber field, so it can be used as simple views counter, but does not allow authors to cheat :).

I added implementation of processRawFieldData() which checks for developer like this:

if (Symphony::Engine()->Author->isDeveloper())

and it works great. Entries are edited only through administration pages (not frontend + events).

Next i wanted to make field "readonly" for non-developer accounts, so i tried using the same check in displayPublishPanel() function. It worked great on administration pages, but frontend page started to crash (no output is given to browser/client) when user is not logged in.

Now i can see that, since user is not logged in, there is no Author object available. My bad - i should have checked for that and should not assume that there will be "dummy" object (like there is in Drupal). I'm sorry :(.

This issue is closed.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details