{"action":"closed","issue":{"url":"https://api.github.com/repos/wpninjas/ninja-forms/issues/2128","repository_url":"https://api.github.com/repos/wpninjas/ninja-forms","labels_url":"https://api.github.com/repos/wpninjas/ninja-forms/issues/2128/labels{/name}","comments_url":"https://api.github.com/repos/wpninjas/ninja-forms/issues/2128/comments","events_url":"https://api.github.com/repos/wpninjas/ninja-forms/issues/2128/events","html_url":"https://github.com/wpninjas/ninja-forms/issues/2128","id":190725049,"number":2128,"title":"Hardcoded database prefix","user":{"login":"code-flow","id":3224401,"avatar_url":"https://avatars.githubusercontent.com/u/3224401?v=3","gravatar_id":"","url":"https://api.github.com/users/code-flow","html_url":"https://github.com/code-flow","followers_url":"https://api.github.com/users/code-flow/followers","following_url":"https://api.github.com/users/code-flow/following{/other_user}","gists_url":"https://api.github.com/users/code-flow/gists{/gist_id}","starred_url":"https://api.github.com/users/code-flow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-flow/subscriptions","organizations_url":"https://api.github.com/users/code-flow/orgs","repos_url":"https://api.github.com/users/code-flow/repos","events_url":"https://api.github.com/users/code-flow/events{/privacy}","received_events_url":"https://api.github.com/users/code-flow/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-21T14:02:28Z","updated_at":"2016-11-21T20:16:47Z","closed_at":"2016-11-21T20:16:47Z","body":"Hey there,\r\nfirst of all thanks for the great plugin. We're currently using version 3.0.15 of it.\r\n\r\nI've found an issue while using form submission limitation functionality. This functionality does not work due to a hardcoded database-prefix in the file [includes/Display/Render.php on line 87](https://github.com/wpninjas/ninja-forms/blob/master/includes/Display/Render.php#L87)\r\n\r\nMaybe you can replace the whole loop with just one database query:\r\n```\r\n$sql = $wpdb->prepare(\r\n\t\t\"SELECT COUNT( * ) FROM {$wpdb->prefix}posts as p INNER JOIN {$wpdb->prefix}postmeta as pm ON ( p.ID = pm.post_id ) WHERE ( ( pm.meta_key = '_form_id' AND pm.meta_value = '%d' ) ) AND p.post_type = 'nf_sub' AND ((p.post_status = 'publish')) GROUP BY p.ID\",\r\n\t\t$form_id\r\n\t);\r\n$count = absint( $wpdb->get_var( $sql ) );\r\n```\r\n\r\nMany greetings!"}}
{"actor":{"display_login":"kjohnson"}}