John Huebner
Forum Replies Created
-
Forum: Plugins
In reply to: [Dynamic Select for Contact Form 7] Categories to dropdownyour filter function should be added to your functions.php file.
Forum: Reviews
In reply to: [Dynamic Recipient for Contact Form 7] Nice little pluginThanks for the kind words about my plugin. Sorry about the instructions being unclear. I’m going to be trying to look at this plugin and test with WP 4.7 before I update the the readme WP version and I’ll try to clarify the instructions as well.
Forum: Plugins
In reply to: [Dynamic Recipient for Contact Form 7] How to use plugin?I’m not sure how to tell you to do this.
The filter that you need to build for this plugin can use the value of other fields in the form. For example, if you had a hidden field what has the user ID of the current user named ‘user_id’ you can pass the value of that field to the filter in this plugin by including another hidden field named “dynamic-mail-to-fields” with the value “user_id”. Then you can get the user’s email from that in the filter that sets the email address.
There are two fields that this plugin depends on to work and it’s better if both of them are hidden.
The first is the field named “dynamic-mail-to-filter” which sets the hook of the filter to use. For example, if you
add_filter('my_dynamic_mailto_filter', 'my_dynamic_mailto_function', 10, 2)then the value of this field would be “my_dynamic_mailto_filter”.The second field is the one I mentioned above. The value of this field should be a comma separated list names of any other form fields in the current form whose values you want to pass to the filter. If the value was “user_id,some_other_field” then the value of the second parameter of the filter would be
Array( [user_id] => 1, [some_other_field] => some other value )hope that helps
Don’t know if this will help or not, took me a while to figure out how to do this for ACF5 and I don’t know if the same thing will work in ACF4. I added a class to my field and then followed the code example on https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/ under adding a filter for select2_args and I came up with this.
(function($){ if (typeof acf.add_action !== 'undefined') { acf.add_filter('select2_args', function(args, element, settings) { if (element.hasClass('glyphicons-select') || element.hasClass('glyphicon_selector')) { args['dropdownCss']['font-family'] = 'Glyphicons Regular'; } return args; }); })(jQuery);Forum: Plugins
In reply to: [Safe Redirect Manager] Editor AccessI did a little more digging this morning, it was a long day yesterday and I was feeling lazy.
There is a hook
add_filter('srm_restrict_to_capability', 'my_srm_restrict_to_capability'); function my_srm_restrict_to_capability($cap) { $cap = 'edit_published_posts'; return $cap; }Forum: Plugins
In reply to: [Dynamic Select for Contact Form 7] Add optgroupI don’t know if I can do this, or do it exactly this way or not.
Can you pop over to github and add this to the issues and I’ll look at it as when I have time https://github.com/Hube2/contact-form-7-dynamic-select-extension/issues
Forum: Plugins
In reply to: [Dynamic Select for Contact Form 7] keep the drop down unselected.add a value to the beginning of the returned selections like
$choices = array( '' => '-- please select --', '1' => 'Choice 1' // etc.... )- This reply was modified 9 years, 10 months ago by John Huebner.
Forum: Plugins
In reply to: [Dynamic Recipient for Contact Form 7] Configuration mail tabYour function is missing the required parameters, most likely because my example is missing the required parameters, I’ll need to fix that.
function wpcf7_dynamic_to_filter($recipient, $args=array()) { if (isset($args['departmentname'])) { $recipient = $args['departmentname']; $recipient = strtolower($recipient); $recipient = str_replace(' ', '', $recipient); $recipient = "myemail+" . $recipient . "@gmail.com"; } } return $recipient; add_filter('wpcf7-dynamic-recipient-filter', 'wpcf7_dynamic_to_filter', 10, 2);Forum: Plugins
In reply to: [Dynamic Select for Contact Form 7] Error message after update of pluginI think it’s because the line in the plugin that includes my examples was uncommented and you have the same function in your theme. I have commented the line again and the update should clear up your problem.
You should probably rename the example function when you copy it to a theme.
If you’re asking if you can use pipes with this plugin the answer is no. Please see this discussion https://wordpress.org/support/topic/how-to-use-pipe-to-hide-emails?replies=6
Forum: Plugins
In reply to: [Dynamic Select for Contact Form 7] How to use PIPE to hide emailsYes, when I originally created this plugin I had a client that wanted to
1) Be able to have a select group of “Subjects”
2) Different contact form submitted with different subjects needed to be emailed to different people
3) They wanted to be able to adjust the subjects and the email addresses on a regular basisI created an ACF options page with a repeater where they could set the subject lines and associated email addresses.
The dynamic select field on the form draws the subjects from this repeater.
Then I built the dynamic recipient plugin to alter the recipient of the email sent by CF7. This required the use of the hidden field plugin so that I could communicate the value needed to select the right email.
It’s probably not the most elegant way to achieve the results I was looking for, but after hours or digging through CF7 and looking at other addons created for CF7 by other developers, it was the best solution I could come up with.
Forum: Plugins
In reply to: [Dynamic Select for Contact Form 7] How to use PIPE to hide emailsSorry, I meant digging through CF7 code. I was working on something in ACF just before replying.
I’ve actually been moving away from CF7, which is why I can’t give this a lot of priority. My clients want something easier to use and I’m trying to move away from needing to create every form for them. The 3 simple add ons I’ve created for CF7, when used in combination, do everything I need them to do.
Basically, if I want to allow someone to select who an email is going to, I use the dynamic select field to show the choices and then I use my dynamic recipient plugin in combination with my hidden field add on to make that happen. This was the purpose of creating these three add ons in the first place. Then I create an options pate in the admin where the client can set up different values and email addresses to use in the select field.
Hope you get your problem worked out. Honestly, I think that CF7 should include some native filters for dynamically populating all types of fields.
Forum: Plugins
In reply to: [Dynamic Select for Contact Form 7] How to use PIPE to hide emailsNo, this plugin does not include any pipe functionality. As I’ve said in other topics, I don’t know how to add it to the plugin.
This plugin only works with simple value/label pairs.
I’m still willing to take pull requests on GitHub if anyone can figure it out and get it to work. Currently I have very little time to work on adding such a feature or spending the hours digging through the ACF code to see what needs to be done. It’s just very low on my priority list right now.
Forum: Plugins
In reply to: [Dynamic Select for Contact Form 7] Select recipients from a custom post typeI’m not sure what you’re doing to be honest. This plugin has limited capabilities and it does not support pipes. The only thing that it can do is to display a list of value => label pairs in a select box and to show the selected value in the in the email content, not the label for that value. What you’re attempting to do is beyond the ability of this plugin.
I have had requests to allow pipes and for adding the label instead of the value to email content, however, I have not been able to figure out how to do so, mostly because the documentation for extending CF7 is non-existent and I was unable to figure out what changes need to be made by digging through the CF7 code.
Yes, it would be a useful addition, and if anyone wants to tackle it I would give them credit for the work and I will accept pull requests. https://github.com/Hube2/contact-form-7-dynamic-select-extension/issues/1
Forum: Plugins
In reply to: Disable WP from removing unique html tags for schemaLast note, I don’t do this the way I’ve posted. Some time ago I created a plugin to allow schema.org markup in the editor and I was looking for an answer to why meta tags were working before and why they’re not now. https://github.com/Hube2/wp-schema-org-in-editor