Tuuuukka
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Differences between default RSS feedsFurther inspection shows that the Feed#1 kind of feeds have their content-type set to “application/rss+xml” and Feed#2 have it set to “text/xml”.
But why this is different on different sites, I do not know. Especially as I haven’t tampered with the feeds at all.
The function feed_content_type() in feed.php seems to control the content-type:
function feed_content_type( $type = '' ) { if ( empty( $type ) ) { $type = get_default_feed(); } $types = array( 'rss' => 'application/rss+xml', 'rss2' => 'application/rss+xml', 'rss-http' => 'text/xml', 'atom' => 'application/atom+xml', 'rdf' => 'application/rdf+xml', ); $content_type = ( ! empty( $types[ $type ] ) ) ? $types[ $type ] : 'application/octet-stream'; /** * Filters the content type for a specific feed type. * * @since 2.8.0 * * @param string $content_type Content type indicating the type of data that a feed contains. * @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'. */ return apply_filters( 'feed_content_type', $content_type, $type ); }
This can of course be overridden, but I’m just curious on the whole situation here.
Indeed, the overlay is messed up. I ended up creating a css-file for the admin pages so I could hide the overlay.
In functions.php of my theme:
function custom_admin_css() { wp_enqueue_style( 'custom_admin_css', get_template_directory_uri() . '/admin.css', array(), filemtime( get_template_directory() . '/admin.css' ) ); } add_action( 'admin_enqueue_scripts', 'custom_admin_css', 10 );
And in the admin.css in the root of my theme:
#acf-image-crop-overlay { display: none; }
- This reply was modified 4 years, 9 months ago by Tuuuukka.
It seems like this is where it goes wrong (from display.php):
//handle repeater fields if( isset( $acf['value'] ) ){ if( is_array( $acf['value'] ) ){ $acf['value'] = implode(', ', array_map(function ( $acf_array_value ) { $acf_implode = implode( ',', array_filter($acf_array_value) ); return $acf_implode; }, $acf['value'])); } }
Before this the $acf[‘value’] still has an actual value, but after these functions it’s gone.
- This reply was modified 5 years, 5 months ago by Tuuuukka.
Forum: Plugins
In reply to: [Advanced Forms for ACF] Connect form entries to fields on pageIf I understand correctly, you want to pre-fill the form fields with values from the entry fields? If so, you can do it with $args: https://advancedforms.github.io/guides/basic/displaying-a-form/
There’s the part ‘values’ => array() that you can use to pre-fill the form fields.
For example, could use this in a template file:
$args = array( 'values' => array('field_name_on_form' => $value_from_entry), ); advanced_form('form_id_here', $args);
This of course means that you have to first get the value from the entry and save it as a variable, in this case as $value_from_entry. How to do that depends on the field and how it is set up, but if you’re using ACF, there’s a pretty good documentation for things like this.
If this is not what you’re after, then excuse me ??
I solved the validation for the address field on the form by adding a hidden field that contains the id of the post/page the form is displayed on. validate_form() then picks up that id, uses that id to load the ACF field containing the address and compares it to the address that’s on the form. Thus, if someone “hacks” the code and changes the address on the form field (that’s hidden with CSS and disabled with JS) the form throws an error.
But this is still pretty hacky and anyone can see the email address by looking at the source code.
What would be nice would be to have an id for every email notification. Then with af/form/email/recipient you could add the address AND set the id of the email notification you want to send, i.e:
function filter_email_recipient( .... ) { $email['recipient'] = '[email protected]'; $email['id'] = 'XX'; return $email; }
- This reply was modified 6 years, 1 month ago by Tuuuukka.
A little update on this. The only way I have managed to get this to work is by adding an email field on the form, prefilling it with the sellers address, hiding the rendered field with CSS and disabling it with JS.. I then created the notification and used this field’s value as the recipient.
But this is waaaaay too insecure and hacky. Just by looking at the source code you can see the actual email address and by disabling JS on your browser you can put whatever address you want in that field. No good.
Preventing the rendering of this field on front-end with $args makes it unavailable as the source of a recipient’s email address.
And of course I tried creating PHP functions and using actions like af/email/before_send but no luck. I don’t even get what that af/email/before_send is supposed to be used for, seems like it’s not good for anything really..?