odp123
Forum Replies Created
-
Forum: Plugins
In reply to: [Private groups] Custom roles not automatically added to groupsThis is unfortunately not possible at the moment since we just went live.
But I can set up a test on a dev server this weekend
Forum: Plugins
In reply to: [Private groups] Custom roles not automatically added to groupsOk, we did the test
First we created a test group called ‘group 2’ and assigned ‘Author’ to it. Then we created a new user with the role Author. The user was NOT added automatically to ‘group 2’
Here is an excerpt from capabilities
a:2:{s:10:"underviser";b:1;s:15:"bbp_participant";b:1;}
Forum: Plugins
In reply to: [Private groups] Custom roles not automatically added to groupsa) It is a wordpress group like Administrator, Editor et al. But custom.
c) we used some code to add roles the wordpress way
add_role( 'underviser', __( 'Underviser' ), array( 'read' => true, // true allows this capability 'edit_posts' => false, 'delete_posts' => false, // Use false to explicitly deny ) );
b) On the left we have our user role i bold Underviser
on the right in the dropdown we have selected group1 UnderviserForum: Plugins
In reply to: [Private groups] Custom roles not automatically added to groupsI am sorry I was not being very clear.
Even when new users are registering they are not being added to that group
Forum: Themes and Templates
In reply to: jquery toggleahh yes of cause, thanks Andrew
Forum: Themes and Templates
In reply to: jquery togglethis line is ignored
jQuery(this).toggleClass(“active”); return false;second i changed $ to jQuery other than that it is the same, no?
$(document).ready(function(){ $('.slidingDiv',this).hide(); $('.show_hide').click(function(){ $(this).next('.slidingDiv').slideToggle(); return false; }); });
//
jQuery(document).ready(function(){ //hide all jQuery('.slidingDiv',this).hide(); jQuery(".show_hide").click(function(){ jQuery(".slidingDiv").slideToggle("slow"); return false; }); });
.next is of cause not there but that ‘could’ be besides the point.
If we take the jsfiddle as the working result. implemented directly in wordpress. it goes like this:
//on dom ready we load the function and include $ in the parameter jQuery(document).ready(function($){ //We then hide the divs we want to collapse $('.slidingDiv',this).hide(); //then we make the function that activates when clicking .show_hide classes $('.show_hide').click(function(){ //now we toggle the hidden classes $(this).next('.slidingDiv').slideToggle(); //stop propagation return false; }); //close }); //close
Forum: Themes and Templates
In reply to: jquery toggleit seems to work standalone
Forum: Themes and Templates
In reply to: jquery togglebtw. Vis Profil == Show Profile ??
Forum: Themes and Templates
In reply to: jquery togglethat is because it is being enqueued in the script called collapse.js
Forum: Themes and Templates
In reply to: jquery toggleI’ll post the link but its for a private dev server so please confirm that you have it, and ill remove it again.
thanks!
[link removed]Forum: Themes and Templates
In reply to: jquery toggleyes?
My scripts are enqueued properly and in the right order
Forum: Themes and Templates
In reply to: jquery toggleSorry for the late reply!
In what way do you mean review wp_enqueue_script()?
Forum: Hacks
In reply to: pdf upload on user profile pageHAHAHA never mind I just return $movefile[‘url’] to update_user_meta.
Thanks a bunch bcworkz, learned a lot from this experience
Forum: Hacks
In reply to: pdf upload on user profile pageAhh but this is absolutely perfect.
I hooked up the uploaded file to update_user_meta and now have an array in the db with the filename.
In my author.php I hooked up the file like this, but while it works now, I am not sure if it will work when the month change.
<?php $upload_dir = wp_upload_dir();?> <p><b>PDF: </b><?php echo $upload_dir[‘url’].’/’.$user_id->pdf[‘name’]; ?></p>
would it not be smarter to somehow have the absolute filepath saved with the name or something?
Forum: Hacks
In reply to: pdf upload on user profile pageSo lets say, I have added the filter, and added some kind of check what do I do with the return data. The upload_pdf function by itself called as the form action displays:
string(212) "File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini." } " class="regular-text" />
And Im thinking that the function will only get executed when the form is submitted?
I really appreciate the time you are taking to help me out, but would you be kind to ellaborate on the code i got?
///////////// PDF upload ////////////////// add_action( 'show_user_profile', 'pdf_upload' ); add_action( 'edit_user_profile', 'pdf_upload' ); function pdf_upload( $user ) { ?> <table class="form-table"> <h3>Upload PDF specifications</h3> <span>tutorial</span> <tr> <th><label for="pdf">PDF</label></th> <td> <form action="<?php odp_check_pdf(); ?>" method="post" enctype="multipart/form-data"> <input type="file" name="pdf" id="pdf" value="<?php echo esc_attr( get_the_author_meta( 'pdf', $user->ID ) ); ?>" class="regular-text" /> <input type="hidden" name="hiddenPdf" id="hiddenPdf" value="<?php upload_pdf(); ?>" class="regular-text" /> <input type='submit' class="upl button-primary" value="Upload PDF" id="uploadpdf"/><br /> <span class="description">Please choose a PDF file to upload</span> </form> </td> </tr> </table> <?php } add_filter('wp_check_filetype_and_ext', 'odp_check_pdf', 10, 4); function odp_check_pdf( $data, $file, $filename, $mimes ){ //do the checks //$data is structured as array( 'ext' => $ext, 'type' => $type, 'proper_filename' => $proper_filename ) if ($data['ext']!='pdf') { echo 'nope'; } return $data; } function upload_pdf() { if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' ); $uploadedfile = $_FILES['pdf']; $upload_overrides = array( 'test_form' => false ); $movefile = wp_handle_upload( $uploadedfile, $upload_overrides ); if ( $movefile ) { echo "File is valid, and was successfully uploaded.\n"; var_dump( $movefile); } else { echo "Possible file upload attack!\n"; } } ///////////// PDF upload END //////////////////