Home Forums Plugin Support WP Project Manager Pro Bug report: frontend.php:318

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  towhid 3 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #52910

    Charles
    Member
    Post count: 1

    Hello,

    There is a bug in the loop. The $projects variable is an Array with WP_Post Objects listed by numerical indexes, but the last item of the Array is a key=>value item: [total_projects] => N

    On the front-end, the output generate a last “project” that is in fact a link to the current page.

    I suggest checking if current item of the loop is A) an object and B) is a WP_Post object. Else continue.

    `if (
    !$project_obj->has_permission( $project )
    || !is_object( $project )
    || !is_a( $project, ‘WP_Post' )
    ) {
    continue;
    }`

    Please advise.
    Thank you

    #53768

    towhid
    Participant
    Post count: 4505

    Hello Charles,

    Sorry for my late reply. I am really sorry to say that I did not understand your question. Can you please clear the question more.

    Thanks

    #53782

    Charles
    Member
    Post count: 1

    Hello again,

    I am not asking a question. I am stating that there is error in you code, I am explaining to you what it is, and I am giving you a way to repair it. I am a senior WordPress developper.

    File: frontend.php, near line 318

    The $projects variable is an Array with WP_Post Objects listed by numerical indexes, but the last item of the Array is a key=>value item: [total_projects] => N

    RESULT: On the front-end, the output generate a last “project” that is in fact a link to the current page.

    You need either to check in the loop if the current item is a WP_Post Object or rebuild the output of the CPM_Project->get_projects to store all the WP_Post Objects inside a single sub array.

    #53902

    towhid
    Participant
    Post count: 4505

    Hello Charles,

    Thank you very much for pointing out the code error to us. I will discuss to our developer team about the error. 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Bug report: frontend.php:318’ is closed to new replies.