code php in version 4.0.5

Discussion in 'Subrion Open Source CMS Core' started by douglas_specht, Jan 10, 2017.

  1. douglas_specht

    douglas_specht New Member

  2. Vasily_B.

    Vasily_B. Project Manager

    Hi,

    Yes, the instructions can be applied for the latest version you have. Do you have some errors? Please be detailed and we will advise.
    Another way to go would be to take Contact Us plugin as an example, and create a new plugin on it.

    1. It creates php controller
    2. This controller has template file
    3. It's registered in the system

    It won't be a problem, just a matter of 5 minutes. Just get rid of useless code in install.xml, and follow basic guidelines:

    1. Plugin name in xml = plugin folder name
    2. Plugin name should be unique
    3. Keep <pages> page record to create a route & page
    4. Keep same files structure

    That's it.
  3. douglas_specht

    douglas_specht New Member

    Many thanks for the reply..
    I reviewed everything and now it worked out ..
    How could I get the name of the user that is logged in to list this php page?
  4. Vasily_B.

    Vasily_B. Project Manager

    Great you got it solved.

    There are a couple of method that could be used for user checks:

    iaUsers::hasIdentity() - checks if a user is authorized
    iaUsers::getIdentity() - returns object of an authorized user attributes, if you pass true as param it will return results as array

    So basic routine is as follows:
    PHP:

    if (iaUsers::hasIdentity())
    {
        _v(iaUsers::getIdentity(true)); // prints array, debug should be enabled
        _v(iaUsers::getIdentity()->username); // prints username
    }
     
    Let me know if you have more questions.
    Andrew_G. likes this.

Share This Page