Category: status

  • Users

    Adding and using custom user profile fields

    Function Reference/update user meta « WordPress Codex

    <?php
    /* =USER Extra Fields (Pilot check dates) */
    // the_author_meta( $meta_key, $user_id );
    add_action( 'show_user_profile', 'nwa_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'nwa_show_extra_profile_fields' );
    
    function nwa_show_extra_profile_fields( $user ) { ?>
    
    	<h3>Pilot Checks</h3>
    
    	<table class="form-table">
    		<tr>
    			<td>
    				<span class="description">Dates when last done:</span>
    			</td>
    			<th><label for="pilot_checkride">135 Checkride</label></th>
    			<td>
    				<input type="text" name="pilot_checkride" id="pilot_checkride" value="<?php echo esc_attr( get_the_author_meta( 'pilot_checkride', $user->ID ) ); ?>" class="regular-text" /><br />
    			</td>
    		</tr>
    		<tr>
    			<th><label for="pilot_med">Class 2 Medical</label></th>
    			<td>
    				<span class="description">Dates when last done:</span>
    				<input type="text" name="pilot_med" id="pilot_med" value="<?php echo esc_attr( get_the_author_meta( 'pilot_med', $user->ID ) ); ?>" class="regular-text" /><br />
    			</td>
    		</tr>
    		<tr>
    			<th><label for="pilot_osa">OSA</label></th>
    			<td>
    				<input type="text" name="pilot_osa" id="pilot_checkride" value="<?php echo esc_attr( get_the_author_meta( 'pilot_osa', $user->ID ) ); ?>" class="regular-text" /><br />
    			</td>
    		</tr>
    	</table>
    <?php }
    
    add_action( 'personal_options_update', 'nwa_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'nwa_save_extra_profile_fields' );
    
    function nwa_save_extra_profile_fields( $user_id ) {
    
    	if ( !current_user_can( 'edit_user', $user_id ) )
    		return false;
    
    	/* Copy and paste this line for additional fields. Make sure to change to the field ID. */
    	update_user_meta( $user_id, 'pilot_checkride', $_POST['pilot_checkride'] );
    	update_user_meta( $user_id, 'pilot_med', $_POST['pilot_med'] );
    	update_user_meta( $user_id, 'pilot_osa', $_POST['pilot_osa'] );
    }
    ?>
    
  • P2 Theme

    add title and edit link (dashboard edit) to lists and single post:
    inc/entry.php, ln 26

    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    

    inc/entry.php, ln 51

    				if ( current_user_can( 'edit_post', get_the_ID() ) ) : ?> | <a href="<?php echo ( get_edit_post_link( get_the_ID() ) ); ?>" class="edit-post-link" rel="<?php the_ID(); ?>"><?php _e( 'Edit', 'p2' ); ?></a> <?php edit_post_link('[edit2]', '| <span style="font:italic 12px serif;">', '</span>'); ?>
    

    (XXX not working yet) prevent new title when using front-end edit:
    functions.php, ln 222:

    function p2_the_title( $before = '&lt;h2&gt;', $after = '&lt;/h2&gt;', $echo = true ) {
    	global $post;
    if ( ! $post-&gt;post_title ) :
    

    front-end editor seems to be visual: messes up code.

  • Slugs

    https://dev.pubmedia.us/slug/ ‎

    example.com/slugname

    Page slug: cpthi, child of p
    https://dev.pubmedia.us/cpthi/testing-2/

    Page slug:
    cpthi=testing-2&post_type=cpthi&name=testing-2

    finds directory in root named: /slugname
    finds CPT slug (post_type or rewrite>slug) defined as: slugname
    finds permalink category base option set to be: slugname
    finds template in active theme file named: page-slugname.php
    finds Page w/ slug (Post_name): “slug-name”
    %postname%

    refresh permalinks
    retention after name change.

    ?finds CPT (hier and non-hi?) w/ slug: “slug-name”
    ?finds category base w/ slug: “slug-name”

    https://dev.pubmedia.us/testing/testing/ finds category-base/
    category_name=testing-2%2Ftesting

    pagename=cpthi

    may depend on which is created first, aka, some remnant of redirect.

    Unique Slug Name

    taxonomy.php in tags/3.3/wp-includes – WordPress Trac

    http://core.trac.wordpress.org/browser/tags/3.3/wp-includes/taxonomy.php#L2175

    Function Reference/wp unique post slug « WordPress Codex

    wp_insert_post()
    wp_insert_attachment()
    calls wp_unique_post_slug()
    $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);

    wp_unique_post_slug() /wp-includes/post.php
    wp_term_post_slug() /wp-includes/taxonomy.php

    http://www.bernzilla.com/item.php?id=1007

    gastropod mollusc

    Function_Reference/sanitize_title_with_dashes
    wp/includes/formatting.php:855: function sanitize_title_with_dashes

    https://dev.pubmedia.us/testing/

    wp_unique_post_slug()
    http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-includes/post.php.source.html#l2779

    wp_unique_term_slug()
    http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-includes/post.php.source.html#l2779

    User:Amereservant/Editing and Customizing htaccess Indirectly « WordPress Codex

    [wp-testers] WordPress scaling problems

    Class Reference/WP Rewrite « WordPress Codex

    How the Postname Permalinks in WordPress 3.3 Work » Otto on WordPress

    http://codex.wordpress.org/Query_Overview

    Function_Reference/wp_parse_args
    /wp-includes/functions.php

    in wp-includes/theme.php
    bunch of theme files camparisons to
    Function_Reference/get_queried_object
    /wp-includes/query.php.

    /wp-includes/rewrite.php
    builds global $wp_rewrite;

    load up array in:
    locate_template()
    wp-includes/theme.php

    wp-includes/link-template.php

    Query_Overview
    wp-includes/classes.php
    parse_request()

    Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request

    ie, on a wp_insert_post() WP will accurately return the results of wp_unique_post_slug() as the “Permalink:” URL on the Page Edit screen (and store it as ___ in the db). but whether that URL will find the page has nada to do w/ either of those functions.

    some retention of some of these values for redirects even after the value changed.

    once the top-level match is found, next level don’t affect query.

    tag base

    http://lists.automattic.com/pipermail/wp-testers/2009-January/011099.html

    /%category%/%postname%/
    /{category_base}/{term_id}/
    whether plugins can affect

    give users the tools to make good choices in naming slugs and defining permalink structure, and to eval what might have gone astray when they get 404s.

    How to change your WordPress Permalink Structure • Yoast