Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3x BUG... #5370

Closed
erikdemarco opened this issue May 8, 2019 · 6 comments

Comments

Projects
None yet
3 participants
@erikdemarco
Copy link

commented May 8, 2019

I'm using table storage and run this script (100% copy paste from the pods site)

$pod = pods( 'book' );

// To add a new item, let's set the data first
$data = array(
    'name' => 'New book name',
    'author' => 2, // User ID for relationship field
    'description' => 'Awesome book, read worthy!'
);

// Add the new item now and get the new ID
$new_book_id = $pod->add( $data ); 

It create the item row succesfully, not 1! but always 3 times. Why?
All my table have 3 duplicate row everytime I add an item.

@issue-label-bot

This comment has been minimized.

Copy link

commented May 8, 2019

Issue-Label Bot is automatically applying the label Type: Bug to this issue, with a confidence of 0.86. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the Type: Bug label May 8, 2019

@JoryHogeveen

This comment has been minimized.

Copy link
Member

commented May 8, 2019

Where did you put this script?

@erikdemarco

This comment has been minimized.

Copy link
Author

commented May 8, 2019

@JoryHogeveen
child theme's functions.php

its really really weird, sometimes it duplicating 3 times sometimes 5 times.
Is it because of i'm using 'table' storage? is table storage still in beta?

@JoryHogeveen

This comment has been minimized.

Copy link
Member

commented May 8, 2019

If you simply pasted this code in your functions.php it's run every time on every page call (even AJAX calls).

Code such as this should be inside a function/method and triggered only when needed with the correct data.

@erikdemarco

This comment has been minimized.

Copy link
Author

commented May 8, 2019

@JoryHogeveen I tried adding echo "12345"; below this code. And the echo code only show one time. So the probability of a bug inside save_pod_item is quite high. (that save_pod_item function is really really long)

@JoryHogeveen

This comment has been minimized.

Copy link
Member

commented May 8, 2019

@erikdemarco

I tried adding echo "12345"; below this code. And the echo code only show one time. So the probability of a bug inside save_pod_item is quite high. (that save_pod_item function is really really long)

It could also be triggered because of an AJAX request (WP heartbeat for example) if the code is not within an a function (action).

@erikdemarco erikdemarco closed this May 9, 2019

@sc0ttkclark sc0ttkclark added this to the Pods 2.7.13 milestone Jun 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.