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
Closed

3x BUG... #5370

erikdemarco opened this issue May 8, 2019 · 6 comments
Labels
Status: Need User Feedback Waiting on feedback from user who reported issue Type: Bug
Milestone

Comments

@erikdemarco
Copy link

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
Copy link

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.

@JoryHogeveen
Copy link
Member

Where did you put this script?

@JoryHogeveen JoryHogeveen added the Status: Need User Feedback Waiting on feedback from user who reported issue label May 8, 2019
@erikdemarco
Copy link
Author

@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
Copy link
Member

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
Copy link
Author

@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
Copy link
Member

@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).

@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
Labels
Status: Need User Feedback Waiting on feedback from user who reported issue Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants