makbeta
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact Form 7] Contact Form 7 not attachment filesI’ve ran into the same problem.
See the details in this issue the latest comment includes a link to a solution that works in CF7 v5.5.5I’ve ran into the same problem.
See the details in this issue the latest comment includes a link to a solution that works in CF7 v5.5.5The solution for version 5.5 can be viewed on Github.
https://github.com/makbeta/contact-form-7/commit/2a5706e3cdd7d1d7054b406c3443475bcd928531Please comment on the Github issue if this is your problem and/or if this solution worked for you https://github.com/takayukister/contact-form-7/issues/707 so the updates get incorporated into the new code base.
As of version 5.5, the plugin completely ignores the setting WPCF7_UPLOADS_TMP_DIR when it’s outside of WP_CONTENT directory. Thus causing more issues on the servers where the UPLOAD directory is aliased. The solution above will no longer work. ??
Forum: Plugins
In reply to: [Contact Form 7] Attached files are not sent anymoreThe temporary workaround until this issue is addressed, for those who host their files in a different location is to comment out the following code in
/contact-form-7/includes/mail.php
. This solved the issue with attachment for me.if ( ! wpcf7_is_file_path_in_content_dir( $path ) ) { if ( WP_DEBUG ) { trigger_error( sprintf( /* translators: %s: Attachment file path. */ __( 'Failed to attach a file. %s is not in the allowed directory.', 'contact-form-7' ), $path ), E_USER_NOTICE ); } return false; }
- This reply was modified 3 years, 8 months ago by makbeta. Reason: improved call formatting
Forum: Plugins
In reply to: [Contact Form 7] Attached files are not sent anymoreWe’ve run into the similar issue on our site, since a recent update the attachments are no longer being sent. I’ve been able to identify the problem and including the solution below.
Problem
Our site is hosted on Pantheon. So the WordPress code lives in/code
folder and all files live in/files
folder. This was not the problem before.Per documented instructions the upload path can be customized to any location. In case of server such as Pantheon the standard path of files
/wp-content/uploads
is just an alias to the/files
folder.The code in the Contact Form 7 plugin in file mail.php does the explicit check that the attachment is in the WP_CONTENT directory
if ( ! wpcf7_is_file_path_in_content_dir( $path ) ) {
. In our case this will always be false so the attachment is never attached although it does exist in a directory that the plugin can freely read.This is a wrong assumption for the code to make. It may work with traditional servers. But as hosts try to optimize content delivery by segmenting out files, this will fail. Pantheon is being one such host.
Replication Steps
* Create a WordPress installation
* Create a file storage folder outside of the WordPress code folder
* Create a symbolic link from/wp-content/uploads
to lead to a new folder created in a previous step
* Configure a form with file attachment
* Submit the form, see the email with out an attachmentProposed Solution
Replace the statementif ( ! wpcf7_is_file_path_in_content_dir( $path ) ) {
with a check that the plugin user has access to the directory and permissions to read the attached file. This will ensure that only authorized files are attached and will not fail when the files live outside of the WordPress structure.If that doesn’t seem to be the best solution, then another option is to verify that the file lives in the directory specified by
WPCF7_UPLOADS_TMP_DIR
which may be an absolute server path and also live outside of WordPress root directory.@takayukister Please let me know if this is sufficient information to create a solution. Don’t hesitate to reach out if you need any additional
Your solution didn’t quite work. I have spend a bit of time and it seems that the more precise regular expressions are needed to target only the space between tags.
I am including the code below that worked for me. It removes all spacers between rows and columns, but keep line breaks within columns. Hope this helps.
function gsc_row_sc( $atts, $content = null ) { $before_column_regex = '/^(\s*(<p>)*(<\/p>)*(<br \/>)*(<br>)*)*(\[GDC_column)/'; $mid_column_regex = '/(\[\/GDC_column\])(\s*(<p>)*(<\/p>)*(<br \/>)*(<br>)*)*(\[GDC_column)/'; $last_column_regex = '/(\[\/GDC_column\])(\s*(<p>)*(<\/p>)*(<br \/>)*(<br>)*)*$/'; $new_content = trim(strstr($content, '[GDC_')); $new_content = preg_replace($before_column_regex, "$6", $new_content); $new_content = preg_replace($mid_column_regex, "$1$7", $new_content); $new_content = preg_replace($last_column_regex, "$1", $new_content); $output = '<div class="gdc_row">' . $new_content . '</div>'; return do_shortcode($output); }
Dear @spwebguy,
While the plugin is not inserting paragraphs the inserted code doesn’t work with the default WordPress configuration when the wpautop is enabled. As mentioned above the plugin seems to handle one configuration of new lines better than others. And it’s the code that is inserted by the plugin that fails to be properly rendered.
Sadly, disabling the auto paragraphs is not a viable solution because it will break the display of the content on the existing site. Also, what if the users decide to insert multiple paragraphs in a column? By default, p tags are not inserted by the WordPress classic editor. So the use of the plugin becomes more and more difficult. Since the plugin doesn’t work as designed out of box it may result in a low adoption rates and eventually obsolescence.
What I propose is to solve the problem so the plugin works as expected out of the box, not requiring two to three additional workarounds to be implemented by a developer.
**Proposed solution**
Before the shortcodes are replaced, the plugin should strip out all the white spaces between[GD_]
&[/GD_]
shortcuts. The spaces everywhere else should be kept intact. This should ensure that all columns are rendered without any extra markup between then.I can also write a code snippet for the solution, if that helps. I could apply the solution to the work I’m doing. However, that would prevent the site I’m working on from receiving updates for the plugin. I suspect that many other people will run into the same problem and I want to make sure that it’s solved for all the people and this plugin has a good and long life.
Thank you for your consideration.
- This reply was modified 4 years, 9 months ago by makbeta.
Forum: Plugins
In reply to: [Mollom] Captcha not displayingI ran into the same issue and have found that if enable html5 for my genesis child theme, the Mollom information shows up. However, when XHTML is enabled none of the information that appeared in ‘comment_notes_after’ filter appear. That is because Genesis does this for XHTML theme
'comment_notes_after' => '',
, which wipes out Mollom.What I have done is removed the genesis filter from comments like so:
remove_filter( 'comment_form_defaults', 'genesis_comment_form_args');
I also didn’t want “allowed tags” to display after my comment from, so instead of hiding it with a filter in function.php, I just used CSS.
Hope this helps.
Forum: Plugins
In reply to: [Theme My Login] Customizing ProfileThe best way to customize the look & feel is to copy the theme-my-login.css from the plugin’s folder into your theme’s folder & add CSS there for your desired backgrounds etc.
Once you install the plugin go to TML > General and click Enable Themed Profiles. Then under TML > Themed Profiles enable which roles you want the themed profile to appear for. Once you do that, all links to my account should redirect to your themed profile page.
Hope this helps.
Martin,
My code is running on the latest version of the BuddyPress and works without a hitch in my install.To debug your issues I would suggest first trying to see if the function is being called at all. Put
print "I'm here"
inbfg_bp_core_fetch_avatar()
.
If the function is being called then I would jump to see whatis_default_gravatar()
returns on your user. If you site is secure you might want to modify the $url to start with https:// rather than https://Hope this helps to get you started.
Forum: Plugins
In reply to: [Safe Redirect Manager] Regex in the to fieldThanks @taylor Lovett, works great now.
here’s the code I’ve used successfully to fix my issue:
add_filter( 'bp_core_fetch_avatar', 'bfg_bp_core_fetch_avatar', 15, 2 ); /** * bfg_bp_core_fetch_avatar() * * Modifieds the BuddyPress avatar with WP Social Login avatar if default avatar is rendered * * * @param string $bp_avatar Avatar image returned by BuddyPress * @param array $args Determine the output of this function * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg */ function bfg_bp_core_fetch_avatar($bp_avatar, $args = '') { $params = wp_parse_args( $args, array( 'item_id' => false, 'object' => $def_object, // user/group/blog/custom type (if you use filters) 'type' => $def_type, // thumb or full 'avatar_dir' => false, // Specify a custom avatar directory for your object 'width' => false, // Custom width (int) 'height' => false, // Custom height (int) 'class' => $def_class, // Custom <img> class (string) 'css_id' => false, // Custom <img> ID (string) 'alt' => '', // Custom <img> alt (string) 'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it 'no_grav' => false, // If there is no avatar found, return false instead of a grav? 'html' => true, // Wrap the return img URL in <img /> 'title' => '' // Custom <img> title (string) ) ); extract( $params, EXTR_SKIP ); //modify only user's avatars and if(!empty ($bp_avatar) && $object == 'user' && get_option('wsl_settings_users_avatars')) { if(empty($email) && !empty($item_id)) { $email = get_userdata($item_id)->user_email; } if($item_id || $email) { if(is_default_gravatar($email)) { $user_thumbnail = get_user_meta ($item_id, 'wsl_user_image', true); if ($user_thumbnail !== false && strlen(trim($user_thumbnail)) > 0) { $user_thumbnail = preg_replace ('#src=([\'"])([^\\1]+)\\1#Ui', "src=\\1" . $user_thumbnail . "\\1", $bp_avatar); if (!is_ssl()) { $user_thumbnail = str_replace('https', 'http', $user_thumbnail); } return $user_thumbnail; } } } } return $bp_avatar; } //given user e-mail tests if gravatar exits or a default image is rendered //returns true if default image is going to be used, false if a valid gravatar image exists function is_default_gravatar($email) { // Craft a potential url and test its headers $hash = md5(strtolower(trim($email))); $uri = 'https://www.gravatar.com/avatar/' . $hash . '?d=404'; $headers = @get_headers($uri); return !preg_match("|200|", $headers[0]); }
Hope this helps.
I came across this article, but didn’t find the link helpful. I’ve used other snippets to construct the function below, which will display tags if include_tags=’true’ is specified in the shortcode itself.
add_filter( 'display_posts_shortcode_output', 'display_posts_with_tags', 10, 7 ); function display_posts_with_tags( $output, $atts, $image, $title, $date, $excerpt, $inner_wrapper ) { $tags = ''; if (array_key_exists('include_tags', $atts) && $atts['include_tags'] ) { $posttags = get_the_tags(); if ($posttags) { $tags = '<div class="tags">'; foreach($posttags as $tag) { $tags .= $tag->name . ' '; } $tags .= '</div>'; } } // First check if an excerpt is included by looking at the shortcode $atts if ( $atts['include_excerpt'] ) // Now let's rebuild the excerpt with the facebook code at the end $excerpt = '<div class="excerpt">' . get_the_excerpt() . '</div>'; else $excerpt = ''; // Now let's rebuild the output. Only the excerpt changed so we're using the original $image, $title, and $date $output = '<' . $inner_wrapper . ' class="listing-item">' . $image . $title . $date . $excerpt . $tags . '</' . $inner_wrapper . '>'; // Finally we'll return the modified output return $output; }
Hope this helps someone.
Another vote for Buddy Press support.
I’ve recently coded a filter function to use wsl_image if Buddy Press returns default avatar. Will be more than happy to share the code upon request.