@@ 1195-1220 (lines=26) @@ | ||
1192 | $id = $post_id; |
|
1193 | $pod = null; |
|
1194 | ||
1195 | foreach ( $groups as $group ) { |
|
1196 | if ( empty( $group[ 'fields' ] ) ) |
|
1197 | continue; |
|
1198 | ||
1199 | if ( null === $pod || ( is_object( $pod ) && $pod->id() != $id ) ) { |
|
1200 | if ( !is_object( self::$current_pod ) || self::$current_pod->pod != $group[ 'pod' ][ 'name' ] ) |
|
1201 | self::$current_pod = pods( $group[ 'pod' ][ 'name' ], $id, true ); |
|
1202 | elseif ( self::$current_pod->id() != $id ) |
|
1203 | self::$current_pod->fetch( $id ); |
|
1204 | ||
1205 | $pod = self::$current_pod; |
|
1206 | } |
|
1207 | ||
1208 | foreach ( $group[ 'fields' ] as $field ) { |
|
1209 | ||
1210 | if ( false === PodsForm::permission( $field[ 'type' ], $field[ 'name' ], $field, $group[ 'fields' ], $pod, $id ) ) { |
|
1211 | if ( !pods_var( 'hidden', $field[ 'options' ], false ) ) |
|
1212 | continue; |
|
1213 | } |
|
1214 | ||
1215 | $data[ $field[ 'name' ] ] = ''; |
|
1216 | ||
1217 | if ( isset( $_POST[ 'pods_meta_' . $field[ 'name' ] ] ) ) |
|
1218 | $data[ $field[ 'name' ] ] = $_POST[ 'pods_meta_' . $field[ 'name' ] ]; |
|
1219 | } |
|
1220 | } |
|
1221 | ||
1222 | if ( $is_new_item ) { |
|
1223 | do_action( 'pods_meta_create_pre_post', $data, $pod, $id, $groups, $post, $post->post_type ); |
|
@@ 1395-1420 (lines=26) @@ | ||
1392 | $id = $post_id; |
|
1393 | $pod = null; |
|
1394 | ||
1395 | foreach ( $groups as $group ) { |
|
1396 | if ( empty( $group[ 'fields' ] ) ) |
|
1397 | continue; |
|
1398 | ||
1399 | if ( null === $pod || ( is_object( $pod ) && $pod->id() != $id ) ) { |
|
1400 | if ( !is_object( self::$current_pod ) || self::$current_pod->pod != $group[ 'pod' ][ 'name' ] ) |
|
1401 | self::$current_pod = pods( $group[ 'pod' ][ 'name' ], $id, true ); |
|
1402 | elseif ( self::$current_pod->id() != $id ) |
|
1403 | self::$current_pod->fetch( $id ); |
|
1404 | ||
1405 | $pod = self::$current_pod; |
|
1406 | } |
|
1407 | ||
1408 | foreach ( $group[ 'fields' ] as $field ) { |
|
1409 | ||
1410 | if ( false === PodsForm::permission( $field[ 'type' ], $field[ 'name' ], $field, $group[ 'fields' ], $pod, $id ) ) { |
|
1411 | if ( !pods_var( 'hidden', $field[ 'options' ], false ) ) |
|
1412 | continue; |
|
1413 | } |
|
1414 | ||
1415 | $data[ $field[ 'name' ] ] = ''; |
|
1416 | ||
1417 | if ( isset( $_POST[ 'pods_meta_' . $field[ 'name' ] ] ) ) |
|
1418 | $data[ $field[ 'name' ] ] = $_POST[ 'pods_meta_' . $field[ 'name' ] ]; |
|
1419 | } |
|
1420 | } |
|
1421 | ||
1422 | do_action( 'pods_meta_save_pre_media', $data, $pod, $id, $groups, $post, $attachment ); |
|
1423 | ||
@@ 1806-1836 (lines=31) @@ | ||
1803 | $id = $user_id; |
|
1804 | $pod = null; |
|
1805 | ||
1806 | foreach ( $groups as $group ) { |
|
1807 | if ( empty( $group[ 'fields' ] ) ) { |
|
1808 | continue; |
|
1809 | } |
|
1810 | ||
1811 | if ( null === $pod || ( is_object( $pod ) && $pod->id() != $id ) ) { |
|
1812 | if ( !is_object( self::$current_pod ) || self::$current_pod->pod != $group[ 'pod' ][ 'name' ] ) { |
|
1813 | self::$current_pod = pods( $group[ 'pod' ][ 'name' ], $id, true ); |
|
1814 | } |
|
1815 | elseif ( self::$current_pod->id() != $id ) { |
|
1816 | self::$current_pod->fetch( $id ); |
|
1817 | } |
|
1818 | ||
1819 | $pod = self::$current_pod; |
|
1820 | } |
|
1821 | ||
1822 | foreach ( $group[ 'fields' ] as $field ) { |
|
1823 | ||
1824 | if ( false === PodsForm::permission( $field[ 'type' ], $field[ 'name' ], $field, $group[ 'fields' ], $pod, $id ) ) { |
|
1825 | if ( !pods_var( 'hidden', $field[ 'options' ], false ) ) { |
|
1826 | continue; |
|
1827 | } |
|
1828 | } |
|
1829 | ||
1830 | $data[ $field[ 'name' ] ] = ''; |
|
1831 | ||
1832 | if ( isset( $_POST[ 'pods_meta_' . $field[ 'name' ] ] ) ) { |
|
1833 | $data[ $field[ 'name' ] ] = $_POST[ 'pods_meta_' . $field[ 'name' ] ]; |
|
1834 | } |
|
1835 | } |
|
1836 | } |
|
1837 | ||
1838 | if ( $is_new_item ) { |
|
1839 | do_action( 'pods_meta_create_pre_user', $data, $pod, $id, $groups ); |
|
@@ 2207-2231 (lines=25) @@ | ||
2204 | $id = $comment_id; |
|
2205 | $pod = null; |
|
2206 | ||
2207 | foreach ( $groups as $group ) { |
|
2208 | if ( empty( $group[ 'fields' ] ) ) |
|
2209 | continue; |
|
2210 | ||
2211 | if ( null === $pod || ( is_object( $pod ) && $pod->id() != $id ) ) { |
|
2212 | if ( !is_object( self::$current_pod ) || self::$current_pod->pod != $group[ 'pod' ][ 'name' ] ) |
|
2213 | self::$current_pod = pods( $group[ 'pod' ][ 'name' ], $id, true ); |
|
2214 | elseif ( self::$current_pod->id() != $id ) |
|
2215 | self::$current_pod->fetch( $id ); |
|
2216 | ||
2217 | $pod = self::$current_pod; |
|
2218 | } |
|
2219 | ||
2220 | foreach ( $group[ 'fields' ] as $field ) { |
|
2221 | if ( false === PodsForm::permission( $field[ 'type' ], $field[ 'name' ], $field, $group[ 'fields' ], $pod, $id ) ) { |
|
2222 | if ( !pods_var( 'hidden', $field[ 'options' ], false ) ) |
|
2223 | continue; |
|
2224 | } |
|
2225 | ||
2226 | $data[ $field[ 'name' ] ] = ''; |
|
2227 | ||
2228 | if ( isset( $_POST[ 'pods_meta_' . $field[ 'name' ] ] ) ) |
|
2229 | $data[ $field[ 'name' ] ] = $_POST[ 'pods_meta_' . $field[ 'name' ] ]; |
|
2230 | } |
|
2231 | } |
|
2232 | ||
2233 | do_action( 'pods_meta_save_pre_comment', $data, $pod, $id, $groups ); |
|
2234 |