msargenttrue
Forum Replies Created
-
Forum: Plugins
In reply to: [Frontend Uploader] Fix to Broken wysiwyg editor in v1.3.2Rinat,
Thanks for the quick update. No rush on the next release, I’m fine with having the hack in place until the next version comes out.
Forum: Plugins
In reply to: [Timely All-in-One Events Calendar] Importing Google Calendar AttachmentsSorry for the delay, here’s the feed URL:
https://calendar.google.com/calendar/ical/icpainc.org%40gmail.com/private-c43da56a9224adb2022c8de3d3bf3611/basic.icsResolved
I was overcomplicating this, I didn’t end up needing the fu_modify_post_overrides hack. I was also thrown off that the Manage UGC section didn’t populate with posts to moderate right away so I thought it wasn’t working.
I ended up using the fu_upload_result_query_args filter with wp_update_post to change the post status.
Here’s the code:
add_filter( 'fu_upload_result_query_args', 'my_fu_upload_result_query_args', 10, 2 ); function my_fu_upload_result_query_args( $qa, $result ) { $qa['post_id'] = isset( $result['post_id'] ) ? $result['post_id'] : array(); $my_post = array( 'ID' => $qa['post_id'], 'post_status' => 'private', ); wp_update_post( $my_post ); return $qa; }So, I was curious to see if this would work: I added a tiny hack to the plugin to give it a hook to allow modification of the $post_overrides array.
Before line 289 I added the following:
// Added filter to modify $post_overrides array $post_overrides = apply_filters( 'fu_modify_post_overrides', $post_overrides );Then I added the following in my functions.php to change ‘post_status’ to ‘private’:
add_filter( 'fu_modify_post_overrides', 'my_fu_modify_post_overrides', 10, 2 ); function my_fu_modify_post_overrides( $post_overrides ) { $post_overrides = array( 'post_status' => 'private', ); return $post_overrides; }I verified that post_status is changing to private, however the posts/attachments being submitted through the Uploader are still being published and don’t show up in Manage UGC. Am I missing something?
Thanks,
Mike SHello again,
I’ve been looking into this further. I don’t necessary need 2 different “Auto-approve registered users files” settings. I want to keep it globally ‘checked’ to apply to the first form but I want to be able to override the setting when files are uploaded through the second form.
I’m looking at frontend-uploader.php and it looks like what I need is within the _upload_files() function: In $post_overrides I want to set ‘post_status’ to ‘private’ every time I upload something through the second File Uploader.
Can I use the ‘fu_after_upload’ action to override ‘post_status’? It looks like this hook is too late in the process since the media_handle_sideload( … ) stuff already happens before this hook.
So if I can’t use ‘fu_after_upload’ is there anything I can use to modify the contents of the $post_overrides array? Or is there a better way to achieve this?
Thanks for your help,
Mike SForum: Plugins
In reply to: [Improved user search in backend] custom fields do not searchHi dale3h,
Thanks for your response. Since I’m not super savvy with regular expressions, can you specify exactly where the underscore went?
I’m not sure if the end means:
/^[a-zA-Z0-9,]+$/_or
/^[a-zA-Z0-9,_]+$/or something else.
Also, was this with LucaRosaldi’s fix or without?
Forum: Plugins
In reply to: [Frontend Uploader] Get URL of uploaded mediaHi shri80,
I just went through the process of retrieving uploaded file URLS from the frontend uploader redirect page. You can view the details of the post here:
Hope this helps.
Your half-awake coding skills aren’t half bad! 😉
Now it works exactly how I wanted it to. Great!
The only issue I noticed is that there was a typo in the variable name, on this line:
$clickable_links .= '<p><a href="' . $fu_download_link . '">' . $fu_download_links . '</a></p>';I changed it so it reads:
$clickable_links .= '<p><a href="' . $fu_download_link . '">' . $fu_download_link . '</a></p>';So if anyone is interested, we could call this mod something like: Retrieve Upload URLs on Redirect
I made a couple other little edits:
1) I added a Title to introduce the links: “URLs to Uploaded Files”.
2) The URLS are now outputted as unordered list items to improve the look.
3) I added a condition to check if the media_ids are set. It will now output a message if they’re not. Before I did this navigating to the redirect page by itself in the browser would output a PHP error.So here’s the final code for functions.php:
add_filter( 'fu_upload_result_query_args', 'my_fu_upload_result_query_args', 10, 2 ); function my_fu_upload_result_query_args( $qa, $result ) { $qa['media_ids'] = isset( $result['media_ids'] ) ? $result['media_ids'] : array(); return $qa; } add_shortcode( 'fu-display-links', 'display_fu_links_shortcode' ); function display_fu_links_shortcode ( $atts ) { $clickable_links = ''; $html_before = '<h3>URLs to Uploaded Files:</h3><ul class="fu-uploaded-files">'; $html_after = '</ul>'; if ( isset( $_GET['media_ids'] )) { foreach( $_GET['media_ids'] as $attachment_id ) { $fu_download_link = wp_get_attachment_url($attachment_id); $clickable_links .= '<li><a href="' . $fu_download_link . '">' . $fu_download_link . '</a></li>'; } return $html_before . $clickable_links . $html_after; } else { echo "<p>No files were uploaded to this page.</p>"; } }And here’s what the shortcodes on my redirect page look like:
[fu-upload-response] [fu-display-links]Thanks so much for your help 🙂
Forum: Plugins
In reply to: [Frontend Uploader] Missing data for $_POST in fu_after_upload actionGreat! That fixed it.
Forum: Plugins
In reply to: [Frontend Uploader] Missing data for $_POST in fu_after_upload actionI’m trying to retrieve the filenames of the uploaded files from the $_FILES array but I’m struggling.
print_r($_FILES); clearly works but when I try to loop through $_FILES I’m not getting anything.
Here’s the output I have from print_r($_FILES); after uploading a single file:
Array ( [files] => Array ( [name] => Array ( [0] => testfile.pdf ) [type] => Array ( [0] => application/pdf ) [tmp_name] => Array ( [0] => /tmp/phpkC2Tsw ) [error] => Array ( [0] => 0 ) [size] => Array ( [0] => 1119353 ) ) )I’ve tried looping through the array 2 ways and I’m getting no output. Here’s what I have in functions.php so far.
add_action( 'fu_after_upload', 'my_fu_after_upload', 10, 3 ); function my_fu_after_upload( $attachment_ids, $success, $post_id ) { echo "<pre>"; print_r($_FILES); echo "</pre>"; $count = count($_FILES['files']); for($i=0; $i<=$count; $i++) { if ($_FILES['files'][$i]['size']) echo $_FILES['files'][$i]['name']."\n"; } foreach($_FILES['files'] as $file) { echo $file['name']."\n"; } }Ultimately, I’m trying to retrieve the link(s) of any uploaded file(s) immediately after the file(s) are uploaded. But I’m stuck at how to pull the data I need from $_FILES.
Thanks for any help.
Forum: Plugins
In reply to: [Improved user search in backend] custom fields do not searchI too am having issues with user meta fields not working properly in the search. I tried reinstalling the plugin fresh (v 1.2.6) and implementing LucaRosaldi’s code modifications, unfortunately I’m not having any luck getting proper search results from the meta fields.
Earlier, I also tried this: https://ww.wp.xz.cn/support/topic/search-first-and-last-name and no luck there either.
I’m not sure whether that has an influence over the search results but my meta fields have been set up through the WP-Members plugin:
https://ww.wp.xz.cn/plugins/wp-members/I would love to know how to solve this one.
Thanks,
Mike SForum: Plugins
In reply to: [Improved user search in backend] Search first and last nameI did notice a similar issue with custom meta fields. I used the WP-Members plugin to create the meta fields and I’ve added the ones I want to search for to the User Search Custom Meta Fields box.
I’m using “company_name” as an example: When I search for a 2 part company name like “XYZ Corp” I get no search results, however if I type in part of the company name “XYZ” by itself or “Corp” by itself I get results.
Forum: Plugins
In reply to: [Improved user search in backend] Search first and last nameYes, great enhancement. I would also like to request that this be put into an upcoming release of the plugin. Thanks!
1.) I’m not sure exactly what resolved this but I got it taken care of.
2.) I resolved this one by changing the name of the “backwpup-bc946a-temp” folder to “backwpup-bc946a-temp2”.