APIs on User Portal & Trackback

Filter: ipt_fsqm_up_filter_action_button

Used to add buttons inside user portal call to action section.

Filter Uses

API-User-Portal-CTA

Accepts two arguments. Please see source code below.


/**
 * Add download button inside user portal
 *
 * @param      array  $buttons  Associative array of button elements
 * @param      object $form     Reference to the IPT_FSQM_Form_Elements_Data object
 *
 * @return     array
 */
function fsqm_add_download_up( $buttons, $form ) {
	// We add a download button
	// inside action column of user portal
	$buttons[] = array(
		__( 'Download PDF', 'domain' ),
		'ipt_fsqm_report_download_' . $form->form_id . '_' . $form->data_id,
		$size,
		'none',
		'normal',
		array( 'ipt_fsqm_download_submission' ),
		'button',
		array(),
		array('onclick' => 'javascript:window.location.href="' . wp_nonce_url( admin_url( 'admin-ajax.php?action=ipt_fsqm_exp_download_submission&id=' . $form->data_id ), 'ipt_fsqm_exp_download_sub_' . $form->data_id ) . '"'),
		'',
		'file-pdf',
		'before',
	);

	// But this would just add a button
	// Actual functionality would still need to get implemented
	return $buttons;
}
add_filter( 'ipt_fsqm_up_filter_action_button', 'fsqm_add_download_up', 10, 2 );

Source

Located in classes/class-ipt-fsqm-form-elements-static.php.

Filter: ipt_fsqm_filter_static_report_print

Used to add buttons to the trackback page.

Filter Uses

API-Trackback-CTA

Accepts three parameters. Please see the source code below.

/**
 * Add download button inside trackback
 *
 * @param      array  $buttons  Associative array of button elements
 * @param      object $form     Reference to the IPT_FSQM_Form_Elements_Front object
 * @param      bool   $score    Whether or not score is supposed to be shown
 *
 * @return     array
 */
function fsqm_add_download_tb( $buttons, $form, $score ) {
	// We add a download button
	// inside action column of user portal
	$buttons[] = array(
		__( 'Download PDF', 'domain' ),
		'ipt_fsqm_report_download_' . $form->form_id . '_' . $form->data_id,
		$size,
		'none',
		'normal',
		array( 'ipt_fsqm_download_submission' ),
		'button',
		array(),
		array('onclick' => 'javascript:window.location.href="' . wp_nonce_url( admin_url( 'admin-ajax.php?action=ipt_fsqm_exp_download_submission&id=' . $form->data_id ), 'ipt_fsqm_exp_download_sub_' . $form->data_id ) . '"'),
		'',
		'file-pdf',
		'before',
	);

	// But this would just add a button
	// Actual functionality would still need to get implemented
	return $buttons;
}
add_filter( 'ipt_fsqm_filter_static_report_print', 'fsqm_add_download_tb', 10, 3 );

Source

Located in classes/class-ipt-fsqm-form-elements-static.php.

Swashata has written 257 articles

Hi there, I am the Lead Developer at WPQuark.com. I love to create something beautiful for WordPress and here I write about how to use them. When I am not working, usually I am doing a number of other creative things ;).