GetIdentity Function for PHP giving Fatal Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • richardevans
    New Member
    • Jul 2014
    • 2

    GetIdentity Function for PHP giving Fatal Error

    Hi All,

    I'm having a bit of a dumb moment. I cannot get this function to work, so any help would be appreciated.

    Thanks

    Code:
    <?php
    	 $authorID = Zend_Auth::getInstance()-getIdentity()-author_id;
    $posts = new Application_Model_Posts();
    $numPosts = $posts->getPostsByAuthor($authorID);
    ?> <div><?php echo $numPosts; ?> Posts</div>
    Last edited by Rabbit; Jul 24 '14, 10:49 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    the property access operator is ->, not -

    Comment

    • richardevans
      New Member
      • Jul 2014
      • 2

      #3
      Hiya,

      I've now got the following error:

      Code:
      Notice: Use of undefined constant authorid - assumed 'authorid' in /html/addons/altcover01/custom_layout/partial/cover.phtml on line 359
      
      Notice: Object of class stdClass could not be converted to int in /html/addons/altcover01/custom_layout/partial/cover.phtml on line 359
      Array Posts
      Any clue?

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        you have this error twice. I thought you’d notice that…

        Comment

        Working...