Forum Replies Created

Viewing 15 replies - 1 through 15 (of 23 total)
  • Thread Starter pcgardner

    (@pcgardner)

    Hi @shubhanshukandani, thanks very much for your helpful post. I use the Classic Editor for WordPress, so couldn’t follow your instructions, but what you said enabled me to use PHPmyAdmin to accomplish the same end – without needing to make a duplicate post:

    • I noted the post’s ID and searched for it in the post_id column in the wp_postmeta table.
    • I found the ig_es_is_post_notified meta_key and changed its meta_value from 1 to NULL.
    • Back in WordPress I changed the post’s status to Draft in Quick Edit.
    • I edited the draft post and published it. Straight away it was queued for notification.
    • Simples!

    I entirely agree – this is not acceptable, especially for an open-source project. I hope someone else will create a fork of the project and improve it, because apart from this issue the plugin could do with improvement.

    Thread Starter pcgardner

    (@pcgardner)

    Thanks very much for that helpful reply. I’ll read the links you’ve suggested and get back to you.

    Thread Starter pcgardner

    (@pcgardner)

    Fantastic – thank you! Oddly enough I searched for ‘with selected’ but didn’t find it.

    Thread Starter pcgardner

    (@pcgardner)

    Thank you for those useful tips. I hadn’t seen the article on client-side validation before – there is so much to learn about PDB!

    • This reply was modified 3 years, 6 months ago by pcgardner. Reason: added link
    Thread Starter pcgardner

    (@pcgardner)

    It works (using attr), but on submitting the form, instead of the usual error message and highlighting of the field a little popup appears pointing to the field that says “Please fill out this field”. If more than one field has been set to required, and all are left blank, the popup only appears on the first one. Having corrected it, when I submit the form again the popup appears on the next empty field.

    I can live with this, but it’s rather confusing to the user to have two different systems of highlighting errors. Is there any way of avoiding that?

    Thread Starter pcgardner

    (@pcgardner)

    Thank you – that’s great! Should I set the attribute or the property of the input?

    Thread Starter pcgardner

    (@pcgardner)

    Given that the problem turned out not to be due to the plugin, I’m closing this thread and will look for further help elsewhere. Thanks very much for your assistance so far.

    Thread Starter pcgardner

    (@pcgardner)

    Thank you. I appreciate that these entries cannot be happening via the plugin. They are not causing a problem per se (they are not displayed), and there are only one or two new ones each day, but I am concerned that they might somehow be used for an attack, so I would like them to be deleted automatically.

    I don’t know if this would be the best way of doing it, but I am now thinking of a function that monitors the number of records in the pdb database and, when a new record is detected, checks to see if the email field is empty and if so deletes the record. That would be more efficient than my previous idea of iterating through all the records. Any old records with an empty email field can be deleted manually, which shouldn’t need to be done more than once.

    I don’t think I am competent to write such a function from scratch, unfortunately. Do you have any existing code that could be adapted?

    Thread Starter pcgardner

    (@pcgardner)

    I added the pdb-check_submission filter, but these rogue entries are still appearing. Presumably they are being added by a method that doesn’t use the normal submission route.

    I still think the easiest way to deal with this is to automatically delete them, as in my original question. Is there a way to automatically delete records where the email field is empty? For example, could I add some PHP code to one of the custom templates that would iterate through all the records in the database (unfiltered) and delete those with an empty email field?

    Thread Starter pcgardner

    (@pcgardner)

    Thank you very much – I’ll try the pdb-check_submission filter.

    Thread Starter pcgardner

    (@pcgardner)

    Hi @keraweb

    Thanks for your reply. Perhaps I’m being dim, but I don’t see how this can work for a new book form with no data. Or do I have to create a new PODS post in PHP, get its post_id, set its fields using update_post_meta() or whatever, and then create the PODS form to edit the ‘new’ post? I can do that (I think!), but I was hoping there was a simpler way to pass values to the empty PODS form fields.

    All the best, Phil

    Thread Starter pcgardner

    (@pcgardner)

    Thank you very much for that code. It’s taken me a while to get around to implementing it, but I’ve now got it working. I had to make a few changes:

    add_filter( 'a_z_listing_item_index_letter', 'ignore_quotes_in_a_z_listing', 10, 3 );
    
    function ignore_quotes_in_a_z_listing( $indices, $item, $type ) {
        if ( 'terms' === $type ) {
            $title = $item->name;
        } else {
            $title = get_the_title( $item );
        }
        if ( ( 0 === strpos( $title, '"' ) ) || ( 0 === strpos( $title, '\'' ) ) ) {
    	return [ mb_substr( $title, 1, 1 ) ];
        } else {
    	return $indices;
        }
    }

    Notes

    [1] In line 2 of the function it must be ‘terms‘, not ‘term’; it took me a while to spot that!

    [2] I had to test the first character of $title (so 0, not false), because your code would have caused Land’s End to be alphabetized under ‘A’.

    Thread Starter pcgardner

    (@pcgardner)

    Thanks to your help I now have a fully working index with cross-references incorporated, and thought I would share my customized template in case anyone else wants to do something similar.

    I set up two custom taxonomies (using PODS, but that shouldn’t make any difference). The first is ‘subject’, which has no custom fields and works like categories or tags. The second is ‘cross_reference’, with one custom field called ‘target_subjects’. For example, a cross-reference with the title ‘dunnock’ might have ‘garden birds’ in its target_subjects field.

    Here is my a-z-listing.php template file; it is in the root of my theme folder. The customized section is indicated by comments.

    <?php
    /**
     * Default multicolumn template for the A-Z Listing plugin
     *
     * This template will be given the variable <code>$a_z_query</code> which is an instance
     * of <code>A_Z_Listing</code>.
     *
     * You can override this template by copying this file into your theme
     * directory.
     *
     * @package a-z-listing
     */
    
    /**
     * This value indicates the number of posts to require before a second column
     * is created. However, due to the design of web browsers, the posts will flow
     * evenly between the available columns. E.g. if you have 11 items, a value of
     * 10 here will create two columns with 6 items in the first column and 5 items
     * in the second column.
     */
    $_a_z_listing_minpercol = 10;
    ?>
    <div id="az-tabs">
    	<div id="letters">
    		<div class="az-letters">
    			<?php $a_z_query->the_letters(); ?>
    		</div>
    	</div>
    	<?php if ( $a_z_query->have_letters() ) : ?>
    	<div id="az-slider">
    		<div id="inner-slider">
    			<?php
    			while ( $a_z_query->have_letters() ) :
    				$a_z_query->the_letter();
    				?>
    				<?php if ( $a_z_query->have_items() ) : ?>
    					<?php
    					$item_count  = $a_z_query->get_the_letter_count();
    					$num_columns = ceil(
    						$item_count / $_a_z_listing_minpercol
    					);
    					?>
    					<div class="letter-section"
    						id="<?php $a_z_query->the_letter_id(); ?>">
    						<h2 class="letter-title">
    							<span>
    								<?php $a_z_query->the_letter_title(); ?>
    							</span>
    						</h2>
    						<?php $column_class = "max-$num_columns-columns"; ?>
    						<ul class="columns <?php echo $column_class; ?>">
    							<?php
    							while ( $a_z_query->have_items() ) :
    								$a_z_query->the_item();
    								?>
    								<li>
    /** CUSTOMIZED CODE BEGINS */
    								<?php 
    								$term = $a_z_query->get_the_item_object( 'I understand the issues!' ); 
    								if ( 'cross_reference' === $term->taxonomy ) : ?>
    								<?php $a_z_query->the_title(); ?>:<em> see </em>
    								<?php echo get_term_meta( $term->term_id, '', false )["target_subjects"][0] ; ?>
    								<?php else : ?>
    									<a href="<?php $a_z_query->the_permalink(); ?>">
    										<?php $a_z_query->the_title(); ?>
    									</a>
    								<?php endif ?>
    /** CUSTOMIZED CODE ENDS */
    								</li>
    							<?php endwhile; ?>
    						</ul>
    						<div class="back-to-top">
    							<a href="#letters">
    								<?php _e( 'Back to top', 'a-z-listing' ); ?>
    							</a>
    						</div>
    					</div>
    					<?php
    				endif;
    			endwhile;
    			?>
    		</div>
    	</div>
    </div>
    <?php else : ?>
    	<p>
    		<?php
    		esc_html_e(
    			'There are no posts included in this index.',
    			'a-z-listing'
    		);
    		?>
    	</p>
    	<?php
    endif;
    • This reply was modified 5 years, 4 months ago by pcgardner. Reason: Improved accuracy
    Thread Starter pcgardner

    (@pcgardner)

    But the documentation says:

    taxonomy: sets the taxonomy containing the terms specified in the terms=”” option
    Default value: unset.
    May only contain one value.
    Must be the slug of the taxonomy.

    Presumably the documentation is out of date. If I’d known that I could have saved myself quite a bit of time!

    Anyway, thank you very much for your help. I’ll experiment with the code along the lines you suggest.

Viewing 15 replies - 1 through 15 (of 23 total)