Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi everyone... I have been trying to find a solution for this all night, and I now must ask for help.

I am working on a website that uses datetime to schedule the publish time of an article. The website also has like buttons. Everything works well except when one clicks the like button it throws the following error:" Deprecated: Non-static method MyEvent::start_date() should not be called statically...." I have narrowed down the problem to the following kfunctions code, but cant figure out a way to fix it. Any help you offer will be greatly cherished.

Code: Select all
 class MyEvent{
    function start_date( $field ){
        global $FUNCS;
       
        $start_date = trim($field->get_data());
        if( !preg_match('/(?:19|20)\d\d-(?:0[1-9]|1[012])-(?:0[1-9]|[12][0-9]|3[01])/', $start_date ) ){
            return KFuncs::raise_error( "Incorrect date format" );
        }
       
        // Set publish_date to value of this field
        $f = &$field->siblings[3];
        $publish_date = trim( $f->get_data() );
        if( $publish_date != '0000-00-00 00:00:00' ){
            $start_date = $FUNCS->make_date( $start_date );
            if( $publish_date != $start_date ){
                $f->store_posted_changes( $start_date );
            }
        }
        unset( $f );
       
        return true;
    }
}
The posted code is from this topic Editable Field for Event Date viewtopic.php?p=12070#p12070
Anyway, this method has outdated and was replaced in Couch2.0 viewtopic.php?f=5&t=10241

Particular Error mentioned can be solved by change function start_date( $field ) => static function start_date( $field )
You have saved me a lot of headache Trendoman...I have edited the kfunctions file and might find time to implement the new method... I wish you well
@Trendoman... last appeal for help... I am implementing the like buttons using the following code... however, I have to refresh the page twice for the vote to show... might you see where I am going wrong..ideally, I would like for the like/dislike vote to show without a page refresh.
Code: Select all
<cms:form class="detail-banner-btn" masterpage='index.php' page_id="<cms:show k_page_id />" mode="edit" method="post" anchor="0">
                            <cms:if k_success>
                                <cms:if "<cms:gpc 'vote_up' />">
                                    <cms:db_persist_form my_vote='1' />
                                <cms:else_if "<cms:gpc 'vote_down' />" />
                                    <cms:db_persist_form my_vote='-1' />
                                </cms:if>
                            </cms:if>
                            <button type="submit"  name='vote_up' class="detail-banner-btns" value="1">
                                <i class="fa fa-thumbs-o-up"></i> Like (<cms:show_votes 'my_vote'><cms:show count_up /></cms:show_votes>)
                            </button>
                            <button type="submit"  name='vote_down' class="detail-banner-btns" value="1">
                                <i class="fa fa-thumbs-o-down"></i> Dislike (<cms:show_votes 'my_vote'><cms:show count_down /></cms:show_votes>)
                            </button>
                            <cms:input type='hidden' name='tmp' />
                           
                            </span>
                        </cms:form>
trendoman wrote: The posted code is from this topic Editable Field for Event Date viewtopic.php?p=12070#p12070
Anyway, this method has outdated and was replaced in Couch2.0 viewtopic.php?f=5&t=10241

Particular Error mentioned can be solved by change function start_date( $field ) => static function start_date( $field )



Thanks alot Trendomman... last appeal for help... I am implementing the like buttons using the following code... however, I have to refresh the page twice for the vote to show... might you see where I am going wrong..ideally, I would like for the like/dislike vote to show without a page refresh.

Code: Select all
<cms:form class="detail-banner-btn" masterpage='index.php' page_id="<cms:show k_page_id />" mode="edit" method="post" anchor="0">
                            <cms:if k_success>
                                <cms:if "<cms:gpc 'vote_up' />">
                                    <cms:db_persist_form my_vote='1' />
                                <cms:else_if "<cms:gpc 'vote_down' />" />
                                    <cms:db_persist_form my_vote='-1' />
                                </cms:if>
                            </cms:if>
                            <button type="submit"  name='vote_up' class="detail-banner-btns" value="1">
                                <i class="fa fa-thumbs-o-up"></i> Like (<cms:show_votes 'my_vote'><cms:show count_up /></cms:show_votes>)
                            </button>
                            <button type="submit"  name='vote_down' class="detail-banner-btns" value="1">
                                <i class="fa fa-thumbs-o-down"></i> Dislike (<cms:show_votes 'my_vote'><cms:show count_down /></cms:show_votes>)
                            </button>
                            <cms:input type='hidden' name='tmp' />
                           
                           </span>
                        </cms:form>
I think you can add redirect -
Code: Select all
<cms:if k_success>
   <cms:if "<cms:gpc 'vote_up' />">
      <cms:db_persist_form my_vote='1' />
   <cms:else_if "<cms:gpc 'vote_down' />" />
      <cms:db_persist_form my_vote='-1' />
   </cms:if>
    <cms:redirect k_page_link />
</cms:if>
6 posts Page 1 of 1