• Resolved findingitontheway

    (@findingitontheway)


    Hi Nicholas,

    your plugin is almost what I need and I wonder if your Pro Version fulfils my requirements

    1. I am working on a platform where certain people “apply” for certain event jobs.
    2. After working the event they should upload their work performance record into the platform (that is where your plugin comes into place).
    3. I managed to create the shortcode and even pass it through the “My bookings” shortcode from the Events Manager plugin.
    4. The My Bookings Shortcode basically creates a table of all the events the user was working for.
    5. So since your shortcode is part of the table it is basically shown in every line
    => And here is my first problem. For the first line of the table the upload is working fine. Messages are send out and attachments are attached.
    => But, when I try to upload something in a second line it won’t do it anymore (I can still choose the file but when I hit upload it is not reacting at all.
    => Is this something that can be fixed in the pro version? Is that considered a multiple file upload?
    6. When a user uploaded a file, it is saying upload completed, but the input to upload another file is still visible
    => Since it is only possible to have one work performance record per event (and I am showing the events in a table) I would like to allow one upload per event. After the user uploaded a file it should say: You already uploaded your work performance record or show a link to the respective file (as well as a delete or update button)
    => Does that come with the Pro Version?

    I hope that makes sense :). It is a bit hard to explain without being able to show the actual use case.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author nickboss

    (@nickboss)

    Hi,

    when you have more than one upload forms on the same page, they need to have different upload IDs in order to work. The ID is defined in the shortcode, so you need to have a mechanism to programmatically assign IDs. However, as I understood you want only one shortcode per table, so there should be only one upload form right?

    The upload form can be locked, so that once a file is uploaded the user is not allowed to upload another one, but requires some coding.

    All the above can be done in the Free version as well but require some coding. Can you send me the URL of the page so that I can better understand the workflow?

    Regards

    Nickolas

    Thread Starter findingitontheway

    (@findingitontheway)

    Hi Nickolas,

    thanks for your answer.

    I am afraid the page I am referring to is only visibile to logged in users that have a booking (not sure if sharing user data here would be a good idea^^).

    However, as I understood you want only one shortcode per table, so there should be only one upload form right?

    => I basically want an upload form per row in my table. But since I am using it with Events Manager, the plugin adds a row with every event I am participating at. So my code right now looks like this:

    <table id='dbem-bookings-table' class='widefat post fixed'>
    					<thead>
    						<tr>
    							<th class='manage-column' scope='col'><?php _e('Event', 'events-manager'); ?></th>
    							<th class='manage-column' scope='col'><?php _e('Date', 'events-manager'); ?></th>
    							<th class='manage-column' scope='col'><?php _e('Schiften/Jobs', 'events-manager'); ?></th>
    							<th class='manage-column' scope='col'><?php _e('Status', 'events-manager'); ?></th>
    <th class='manage-column' scope='col'>Arbeitsnachweis hochladen</th>
    						</tr>
    					</thead>
    					<tbody>
    						<?php 
    						$rowno = 0;
    						$event_count = 0;
    						$nonce = wp_create_nonce('booking_cancel');
    						foreach ($EM_Bookings as $EM_Booking) {
    							/* @var $EM_Booking EM_Booking */
    							$EM_Event = $EM_Booking->get_event();						
    							if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
    								$rowno++;
    								?>
    								<tr>
    									<td><?php echo $EM_Event->output("#_EVENTLINK"); ?></td>
    									<td><?php echo date_i18n( get_option('dbem_date_format'), $EM_Event->start ); ?>- <?php echo date_i18n( get_option('dbem_date_format'), $EM_Event->end ); ?><br/> 
    </td>
    									<td><?php echo $EM_Booking->output("#_BOOKINGTICKETS"); ?></td>
    									<td>
    										<?php echo $EM_Booking->get_status(); ?>
    									</td>
    <td>
    												[wordpress_file_upload singlebutton="true"</td>
    																	</tr>								
    								<?php
    							}
    							do_action('em_my_bookings_booking_loop',$EM_Booking);
    							$event_count++;
    						}
    						?>
    					</tbody>
    				</table>

    To give the following result: https://jobs.myeventy.de/wp-content/uploads/overview.JPG

    So that is fine and I understood that I have to generate an ID for each form. Do you happen to offer a development service? So I can hire you to develope that along with other tasks? Your plugin goes definitely in the right direction so I feel like you are the most qualified person for that :).

    Plugin Author nickboss

    (@nickboss)

    Ok here are some suggested mofications to your code. I added a closing bracket in the shortcode and also added PHP code that generates a different (random) 4-digit shortcode id every time.

    <table id='dbem-bookings-table' class='widefat post fixed'>
    	<thead>
    		<tr>
    			<th class='manage-column' scope='col'><?php _e('Event', 'events-manager'); ?></th>
    			<th class='manage-column' scope='col'><?php _e('Date', 'events-manager'); ?></th>
    			<th class='manage-column' scope='col'><?php _e('Schiften/Jobs', 'events-manager'); ?></th>
    			<th class='manage-column' scope='col'><?php _e('Status', 'events-manager'); ?></th>
    			<th class='manage-column' scope='col'>Arbeitsnachweis hochladen</th>
    		</tr>
    	</thead>
    	<tbody>
    		<?php 
    		$rowno = 0;
    		$event_count = 0;
    		$nonce = wp_create_nonce('booking_cancel');
    		foreach ($EM_Bookings as $EM_Booking) {
    			/* @var $EM_Booking EM_Booking */
    			$EM_Event = $EM_Booking->get_event();						
    			if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
    				$rowno++;
    				?>
    				<tr>
    					<td><?php echo $EM_Event->output("#_EVENTLINK"); ?></td>
    					<td><?php echo date_i18n( get_option('dbem_date_format'), $EM_Event->start ); ?>- <?php echo date_i18n( get_option('dbem_date_format'), $EM_Event->end ); ?><br/></td>
    					<td><?php echo $EM_Booking->output("#_BOOKINGTICKETS"); ?></td>
    					<td>
    						<?php echo $EM_Booking->get_status(); ?>
    					</td>
    					<td>[wordpress_file_upload uploadid="<?php mt_srand((double)microtime()*1000000); echo (string)mt_rand(1000, 9999); ?>" singlebutton="true"]</td>
    				</tr>								
    				<?php
    			}
    			do_action('em_my_bookings_booking_loop',$EM_Booking);
    			$event_count++;
    		}
    		?>
    	</tbody>
    </table>

    Try it and let me know.

    Nickolas

    Thread Starter findingitontheway

    (@findingitontheway)

    Hi Nickolas,

    thanks so much. Works like a charm.

    For

    The upload form can be locked, so that once a file is uploaded the user is not allowed to upload another one, but requires some coding.

    Does this already comes with the pro Version?

    Plugin Author nickboss

    (@nickboss)

    Yes this requires a plugin hook. Since you have the free version you need to put it at the end of functions.php file of your theme. Here it is:

    if (!function_exists('wfu_before_upload_handler')) {
    	function wfu_before_upload_handler($changable_data, $additional_data) {
    		$limit = 1;
    		$user = wp_get_current_user();
    		if ( $user->ID != 0 ) {
    			$filerecs = wfu_get_recs_of_user($user->ID);
    			if ( count($filerecs) >= $limit )
    				$changable_data["error_message"] = "File rejected. Maximum upload limit reached.";
    		}
    		return $changable_data;
    	}
    	add_filter('wfu_before_upload', 'wfu_before_upload_handler', 10, 2);
    }

    This will limit the users to one upload. You can change $limit if you want to allow more uploads per user.

    Nickolas

    Thread Starter findingitontheway

    (@findingitontheway)

    Hi Nickolas,

    thanks! I am on the pro version now and am using hooks already. I tried the function you gave me but it isn’t doing much I am afraid. Or maybe my expectations aren’t right?

    I am basically expecting that once the user uploads something in one of the upload forms on https://jobs.myeventy.de/wp-content/uploads/overview.JPG it then says: you already uploaded a file here. Is that not what happens?

    Plugin Author nickboss

    (@nickboss)

    The above script will limit files per user. So, if a logged user has already uploaded a file, he will not be allowed to upload another one.

    What you ask is different?

    Nickolas

    Thread Starter findingitontheway

    (@findingitontheway)

    Okay understood :). That makes sense. I haven’t tested the function to limit the uploads til the end now (cause my client was fine with having several uploads) but I will mark the topic as resolved. Thanks for your help!

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    For pro or commercial product support please contact the author directly on their site. This includes pre-sales questions.

    As the author is aware, commercial products are not supported in these forums. As you are their potential customer I am sure they will have no problem supporting you there.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Questions about the Pro Version’ is closed to new replies.