Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Trying to get property of non-object
Avatar
tyleryoungblood
Seattle, WA
Member
Free Members
sp_UserOfflineSmall Offline
Jan 5, 2013 - 9:18 pm

Well, it's been 2 days and my error log is holding steady at 51 entries, but the auto-increment id is showing that I've had 184,204 notices since truncating the table two days ago. So it's not a single notice or error per page view (I get about 100k page view per month, not per day) so I'm a little stumped as to what's causing the error. I can't really make it happen, it happens all on its own ... frequently.

I guess I'm not too worried about it, but I wish I knew what it was.

Full Texts id error_date error_type error_text
Edit Delete 184204 2013-01-05 19:14:02 php file: /simple-press/sp-api/sp-api-auths.php<br />l...
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 5, 2013 - 9:28 pm

we had that occurring many months and versions ago, but it has not been occurring for folks... and looking at the code, I dont understand how it would happen either...

which is why really need some idea as to when its happening...  any custom theme or plugin work?  have you tried visiting as user or guest, vice admin?

this is the line of code:

        if (empty($spThisUser->ID) && $sfglobals['auths'][$sfglobals['auths_map'][$check]]->ignored) $auth = 0;

but not sure and cannot explain why any of the objects (there is two in that line) would be undefined...

have you created or customized any of the permissions?

maybe try going to forum - toolbox - housekeeping and try resetting the auths cache.. maybe something off there...

Avatar
tyleryoungblood
Seattle, WA
Member
Free Members
sp_UserOfflineSmall Offline
Jan 5, 2013 - 10:33 pm

I reset the authors cache and I'm still getting the notices.

The only customization I have made to the forum that I can think of is adding  adsense adds using the built in hooks.

It looks like the notices show up whenever admins or subscribers view the site. Possibly guests also but it's hard to tell.

I could create an admin account for you (actually, I think you already have one from a problem a few years ago) if you want to take a look around. Let me know if you're interested in figuring it out. If not, no biggie. My OOP skills are a bit weak otherwise I'd try to dig into it more.

 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 6, 2013 - 12:26 am

can you post the adsense code you wrote?  worth a check to make sure its proper...

Avatar
tyleryoungblood
Seattle, WA
Member
Free Members
sp_UserOfflineSmall Offline
Jan 6, 2013 - 1:06 pm

Basically I followed the directions found on this post.

To make sure my changes didn't get overwritten with an update I followed the directions for making a child theme.

Then I edited my spFunctions.php file to include my adsense code (ignore the obfuscating XX's):

<?php
# --------------------------------------------------------------------------------------
#
#    Simple:Press Theme custom function file
#    Theme        :    Default
#    File        :    custom functions
#    Author        :    Simple:Press
#
#    The 'functions' file can be used for custom functions & is loaded with each template
#
# --------------------------------------------------------------------------------------

add_action('init', 'spmytheme_textdomain');

# load the theme textdomain for tranlations
function spmytheme_textdomain() {
    sp_theme_localisation('spmytheme');
}

if (function_exists('sp_FontResizer')) {
    add_action('sph_BeforeDisplayStart', 'spmytheme_spShowFontResize');
}

function spmytheme_spShowFontResize() {
    $tipMinus = __sp('decrease forum font size');
    $tipReset = __sp('reset forum font size');
    $tipPlus  = __sp('increase font size');
    sp_FontResizer('tagClass=spFontSizeControl spRight', $tipMinus, $tipReset, $tipPlus);
    sp_InsertBreak('direction-right');
}

//create a function for placing adsense code in forum
//problem-with-post-edit-buttonttp://simple-press.com/support-forum/sp5-coding-questions/adsense-code/page-3/
function spAdsense728x90() {
    echo '<center><script type="text/javascript"><!--
                google_ad_client = "ca-pub-XXXXXXXXXXXXXXXXXX";
                /* PIM Forum 728x90 */
                google_ad_slot = "00XXXX2059";
                google_ad_width = 728;
                google_ad_height = 90;
                //-->
                </script>
                    <script type="text/javascript"
                    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
            </center>';
}

?>

And then I called the function in my spTopicView.php file (line 155). Sorry for posting the entire file, but since I don't know where the error might be I though't I'd err on the side of overkill.

<?php
# --------------------------------------------------------------------------------------
#
#    Simple:Press Template
#    Theme        :    Default
#    Template    :    topic
#    Author        :    Simple:Press
#
#    The 'topic' template is used to display the Topic/Post Index Listing
#
# --------------------------------------------------------------------------------------


    # == ADD POST FORM - OBJECT DEFINITION ========================
    $addPostForm = array(
        'tagClass'                => 'spForm',
        'hide'                    => 1,
        'controlFieldset'        => 'spEditorFieldset',
        'controlInput'            => 'spControl',
        'controlSubmit'            => 'spSubmit',
        'labelHeading'            => __sp('Add Reply'),
        'labelGuestName'        => __sp('Guest name (required)'),
        'labelGuestEmail'        => __sp('Guest email (required)'),
        'labelModerateAll'        => __sp('NOTE: new posts are subject to administrator approval before being displayed'),
        'labelModerateOnce'        => __sp('NOTE: first posts are subject to administrator approval before being displayed'),
        'labelSmileys'            => __sp('Smileys'),
        'labelOptions'            => __sp('Options'),
        'labelOptionLock'        => __sp('Lock this topic'),
        'labelOptionPin'        => __sp('Pin this post'),
        'labelOptionTime'        => __sp('Edit post timestamp'),
        'labelMath'                => __sp('Math Required'),
        'labelMathSum'            => __sp('What is the sum of'),
        'labelPostButtonReady'    => __sp('Submit Reply'),
        'labelPostButtonMath'    => __sp('Do Math To Save'),
        'labelPostCancel'        => __sp('Cancel')
    );

    # == EDIT POST FORM - OBJECT DEFINITION ========================
    $editPostForm = array(
        'tagClass'                => 'spForm',
        'controlFieldset'        => 'spEditorFieldset',
        'controlInput'            => 'spControl',
        'controlSubmit'            => 'spSubmit',
        'labelHeading'            => __sp('Edit Post'),
        'labelSmileys'            => __sp('Smileys'),
        'labelPostButton'        => __sp('Save Edited Post'),
        'labelPostCancel'        => __sp('Cancel')
    );
    # ==============================================================


    # Load the forum header template - normally first thing
    # ----------------------------------------------------------------------
    sp_SectionStart('tagClass=spHeadContainer', 'head');
        sp_load_template('spHead.php');
    sp_SectionEnd('', 'head');

    sp_SectionStart('tagClass=spBodyContainer', 'body');

        # Start the 'topicView' section
        # ----------------------------------------------------------------------
        sp_SectionStart('tagClass=spListSection', 'topicView');

            # Set the Topic
            # ----------------------------------------------------------------------
            if (sp_this_topic()):
                # Start the 'pagelinks' section
                # ----------------------------------------------------------------------
                sp_SectionStart('tagClass=spPlainSection', 'pageLinks');
                    sp_PostNewButton('tagId=spPostNewButtonTop&tagClass=spButton spRight', __sp('Add Reply'), __sp('Add a new post in this topic'), __sp('This topic is locked'));
                    sp_PostNewTopicButton('tagId=spPostNewTopicButtonTop&tagClass=spButton spRight', __sp('Add Topic'), __sp('Start a new topic'), __sp('This forum is locked'));
                    sp_PostIndexPageLinks('', __sp('Page: '), __sp('Jump to page %PAGE% of this topic'));
                sp_SectionEnd('tagClass=spClear', 'pageLinks');

                # Start the 'topicHeader' section
                # ----------------------------------------------------------------------
                sp_SectionStart('tagClass=spTopicViewSection', 'topic');
                    sp_TopicHeaderRSSButton('tagClass=spButton spRight', __sp('Topic RSS'), __sp('Subscribe to the RSS feed for this topic'));
                    if (function_exists('sp_RelatedTopicsButton')) sp_RelatedTopicsButton('tagClass=spButton spRight', __sp('Related Topics'), __sp('Get a list of related topics based on tags for this topic'));
                    sp_TopicHeaderIcon('tagClass=spHeaderIcon spLeft');
                    sp_TopicHeaderName('tagClass=spHeaderName');
                    if (function_exists('sp_TopicHeaderShowBlogLink')) sp_TopicHeaderShowBlogLink('', __sp('Read the original blog post'), __sp('Click to goto original blog post'));

                    sp_InsertBreak();

                    if (function_exists('sp_TopicTagsList') || function_exists('sp_TopicStatus')) {
                        if (function_exists('sp_TopicTagsList')) sp_TopicTagsList('tagClass=spTopicTagsList spLeft', __sp('Tags: '));
                        if (function_exists('sp_TopicStatus')) sp_TopicStatus('tagClass=spTopicViewStatus spButton spLeft', __sp('Search for other topics with this status'), __sp('Status: '));
                        sp_InsertBreak();
                    }

                    sp_SectionStart('tagClass=spTopicPostContainer', 'postlist');

                        # Start the Post Loop
                        # ----------------------------------------------------------------------
                        if (sp_has_posts()) : while (sp_loop_posts()) : sp_the_post();

                            # Start the 'post' section
                            # ----------------------------------------------------------------------
                            sp_SectionStart('tagClass=spTopicPostSection', 'post');

                                sp_PostIndexAnchor();

                                sp_PostForumToolButton('', '', __sp('Open the forum toolset'));

                                # Column 1 of the post row
                                # ----------------------------------------------------------------------
                                sp_ColumnStart('tagClass=spUserSection spLeft&width=15%&height=50px');
                                    sp_PostIndexUserDate('tagClass=spPostUserDate spCenter');
                                    sp_UserAvatar('tagClass=spPostUserAvatar spCenter&context=user', $spThisPostUser);
                                    sp_PostIndexUserName('tagClass=spPostUserName spCenter');
                                    sp_PostIndexUserLocation('tagClass=spPostUserLocation spCenter');
                                    sp_PostIndexUserRank('tagClass=spPostUserRank spCenter');
                                    sp_PostIndexUserSpecialRank('tagClass=spPostUserSpecialRank spCenter');
                                    sp_PostIndexUserPosts('tagClass=spPostUserPosts spCenter', __sp('Forum Posts: %COUNT%'));
                                    sp_PostIndexUserRegistered('tagClass=spPostUserRegistered spCenter', __sp('Member Since:<br /> %DATE%'));
                                    sp_PostIndexUserStatus('tagClass=spCenter spPostUserStatus', __sp('Online'), __sp('Offline'));
                                    sp_SectionStart('tagClass=spCenter', 'user-identities');
                                        sp_PostIndexUserWebsite('', __sp('Visit my website'));
                                        sp_PostIndexUserTwitter('', __sp('Follow me on Twitter'));
                                        sp_PostIndexUserFacebook('', __sp('Connect with me on Facebook'));
                                        sp_PostIndexUserMySpace('', __sp('See MySpace'));
                                        sp_PostIndexUserLinkedIn('', __sp('My LinkedIn network'));
                                        sp_PostIndexUserYouTube('', __sp('View my YouTube channel'));
                                        sp_PostIndexUserGooglePlus('', __sp('Interact with me on Google Plus'));
                                    sp_SectionEnd('', 'user-identities');
                                sp_ColumnEnd();

                                # Column 2 of the post row
                                # ----------------------------------------------------------------------
                                sp_ColumnStart('tagClass=spPostSection spRight&width=84%');

                                    # Start the 'post' section
                                    # ----------------------------------------------------------------------
                                    sp_SectionStart('tagClass=spPostActionSection', 'action');
                                        sp_GoToTop('tagClass=spRight spGoToTop&iconClass=spIcon', '', __sp('Go to Top'));
                                        sp_PostIndexPinned('tagClass=spStatusIcon spLeft', __sp('This post is pinned'));
                                        if (function_exists('sp_PostIndexPostByEmail')) sp_PostIndexPostByEmail('tagClass=spStatusIcon spLeft', 'This post was sent by email');
                                        sp_PostIndexNumber('tagClass=spLabelBordered spLeft');
                                        sp_PostIndexEditHistory('tagClass=spButton spLeft', '', __sp('Edited by %USER% on %DATE%'), __sp('View edit history'));
                                        sp_PostIndexPermalink('tagClass=spButton spLeft', '', __sp('The post permalink'));
                                        sp_PostIndexPrint('tagClass=spButton spLeft', '', __sp('Print this post'));
                                        sp_PostIndexNewPost('tagClass=spLabelBordered spLeft', __sp('New'));
                                        if (function_exists('sp_PostIndexRatePost')) sp_PostIndexRatePost('tagClass=spLabelBordered spPostRating spRight');
                                        if (function_exists('sp_PostIndexReportPost')) sp_PostIndexReportPost('tagClass=spButton spRight', __sp('Report'), __sp('Report this post to admin'));
                                        sp_PostIndexQuote('tagClass=spButton spRight', __sp('Quote'), __sp('Quote this post and reply'));
                                        sp_PostIndexEdit('tagClass=spButton spRight', __sp('Edit'), __sp('Edit this post'));
                                        sp_PostIndexDelete('tagClass=spButton spRight', 'Delete', 'Delete this post');
                                        if (function_exists('sp_PostIndexSendPm')) sp_PostIndexSendPm('tagClass=spButton spRight', __sp('PM'), __sp('Send PM to this user'));
                                    sp_SectionEnd('', 'action');
                                    sp_InsertBreak();

                                    sp_SectionStart('tagClass=spPostContentSection', 'content');
                                        //adsense code
                                        if($spTopicView->currentPost==1 OR $spTopicView->currentPost==5){ //only display for fist post
                                            if (function_exists('spAdsense728x90')) spAdsense728x90();
                                        }
                                        
                                        sp_PostIndexContent('', __sp('Awaiting Moderation'));
                                    sp_SectionEnd('', 'content');
                                    sp_InsertBreak();

                                    sp_PostIndexUserSignature('tagClass=spPostUserSignature spCenter&maxHeightBottom=55');
                                    sp_InsertBreak();

                                sp_ColumnEnd();

                                sp_InsertBreak();

                            sp_SectionEnd('', 'post');

                        endwhile; else:
                            sp_NoPostsInTopicMessage('tagClass=spMessage', __sp('There are no posts in this topic'));
                        endif;

                    sp_SectionEnd('', 'postlist');

                sp_SectionEnd('', 'topic');

                # Start the 'pagelinks' section
                # ----------------------------------------------------------------------
                sp_SectionStart('tagClass=spPlainSection', 'pageLinks');
                    sp_PostNewButton('tagId=spPostNewButtonBottom&tagClass=spButton spRight', __sp('Add Reply'), __sp('Make a new post in this topic'), __sp('This topic is locked'));
                    sp_PostNewTopicButton('tagId=spPostNewTopicButtonBottom&tagClass=spButton spRight', __sp('Add Topic'), __sp('Start a new topic'), __sp('This forum is locked'));
                    sp_PostIndexPageLinks('', __sp('Page: '), __sp('Jump to page %PAGE% of this topic'));
                    sp_InsertBreak();
                sp_SectionEnd('', 'pageLinks');

                # Start the 'editor' section
                # ----------------------------------------------------------------------
                sp_SectionStart('tagClass=spHiddenSection', 'editor');
                    sp_PostEditorWindow($addPostForm, $editPostForm);
                sp_SectionEnd('', 'editor');
            else:
                sp_NoTopicMessage('tagClass=spMessage', __sp('Access denied - you do not have permission to view this page'), __sp('The requested topic does not exist'));
            endif;

        sp_SectionEnd('', 'topicView');

    sp_SectionEnd('', 'body');

    # Load the forum footer template - normally last thing
    # ----------------------------------------------------------------------
    sp_SectionStart('tagClass=spFootContainer', 'foot');
        sp_load_template('spFoot.php');
    sp_SectionEnd('', 'foot');
?>

My ads are displaying properly, but I guess I could have made a mistake in my child theme creation?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 6, 2013 - 5:25 pm

Question for Steve: Would it be of use asking for a dump of $sfglobals do you think? Will that give enough information? Or - because this seems to only happen when a guest is using the forum will that not be accurate enough?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 7, 2013 - 8:00 pm

you could try a dump of $sfglobals, but he says he cannot make it happen when he wants...   I am actually wondering he is somehow missing an auth...

can you tell me how many rows you have in the sfauths table?  and which sp plugins you are running?

so back in post #12 I asked if you had made any custom permissions or changes to the default permissions...  but you did not answer...  do you know?

I can tell you have to prevent the notice (its not an error), but since it seems like a one off to you, would like to know why...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625