WordPress.org

Ready to get started?Download WordPress

Forums

SpeakUp! Email Petitions
[resolved] Custom field not shown in signature list (2 posts)

  1. Jeremy Malcolm
    Member
    Posted 1 year ago #

    I would like to be able to display an organisation name (which is my custom field) in the signature list. But the custom field isn't shown in the list at all (although in my settings, I have specified that it should be).

    The problem is that the custom field is not added to the $columns array used by includes/class.signaturelist.php even when displays_custom_field is set. I have been trying to fix it myself, but don't know PHP well enough and so haven't had any luck.

    Also, ideally only I would display the person's first and last name if the organisation name isn't present. That's more of a feature request rather than a bug, though.

    http://wordpress.org/extend/plugins/speakup-email-petitions/

  2. Jeremy Malcolm
    Member
    Posted 1 year ago #

    I've written a patch that does what I want.

    --- class.signaturelist.php.dist	2013-05-10 14:46:08.000000000 +0800
    +++ class.signaturelist.php.bak	2013-05-10 14:45:31.000000000 +0800
    @@ -61,7 +61,14 @@
     					$signatures_list .= '<tr class="dk-speakup-odd">';
     				}
     				$signatures_list .= '<td class="dk-speakup-signaturelist-count">' . number_format( $current_signature_number, 0, '.', ',' ) . '</td>';
    -				$signatures_list .= '<td class="dk-speakup-signaturelist-name">' . stripslashes( $signature->first_name . ' ' . $signature->last_name ) . '</td>';
    +				// show custom field instead of name if we have both
    +				$signatures_list .= '<td class="dk-speakup-signaturelist-name">';
    +				if ( $signature->custom_field ) {
    +					$signatures_list .= '<td class="dk-speakup-signaturelist-name">' . stripslashes( $signature->custom_field );
    +				} else {
    +					$signatures_list .= '<td class="dk-speakup-signaturelist-name">' . stripslashes( $signature->first_name . ' ' . $signature->last_name );
    +				}
    +				$signatures_list .= '</td>';
    
     				// if we display both city and state, combine them into one column
     				$city  = ( $display_city )  ? $signature->city : '';

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.