copy fields value to another field

When user registering on my site, they have to entry their phone number for auth (firebase).I have create the phone number field using buddypress’s xprofile plugin, the field named "phone". For some reason, I need to sync the Phone field to user_url field, I tried some plugin like SyncField ,BuddyPress to WordPress Full Sync to help, but the field cannot be sync without modify the content. Any idea to make it work?

Assign wordpress featured images via external URL based on numeric value in custom fields

I have several posts (150) with a custom field ‘floorplan-image-id’ which has a unique value (number) that feeds from XML. The featured image for each post should be automatically assigned via external URL based on the above custom field value.

Example: if floorplan-image-id = 12345 then the Featured image will be : //someurl.com/images/floorplan-1.png

else if floorplan-image-id = 34567 then the Featured image will be : //someurl.com/images/floorplan-2.png

====================

function custom_floorplan-image($ html, $ post_id, $ meta_field) {

$ meta_field = get_post_meta($ post->ID, ‘floorplan-image-id’, true);

if ($  meta_field === '12345') {     $  html = "<img src='"//mysite.com/images/Floorplan_A1.png"'>"; }else if ($  meta_field === '34567') {     $  html = "<img src='"//mysite.com/images/Floorplan_A2.png"'>"; }  return $  html; 

}

add_filter(‘post_thumbnail_html’, ‘custom_floorplan-image’, 10, 3);

How and why use validate_username and how to secure inputs fields of registration form?

I would use validate_username to protect username and other inputs from tags, octet, and others filters and conditions from sanitize_user but these functions only remove these dangerous chars and does not warn the user to not use these chars.

Does it exist a wordpress function of the same kind as validate_username that allow to warn and restrict user to use the same chars and conditions than those used in validate_username function ?

Could you help me to write a regex which fulfills the same conditions as validate_username to display error if one of conditions is positive.

And how I must do to add this regex |%([a-fA-F0-9][a-fA-F0-9])| to this one /^[A-Za-z0-9]$ / I don’t understand the use of | and / . In php.net this | is use to say "or" . For example this /^[A-Za-z0-9]$ / does not take into account octet (or exadecimal ?) as it define here : WordPress sanitize_user/

Knowing that hackers always discover solutions to hack what is to date the best solution to protect a registration and login form. If this last question is duplicate could you please post the link of existing response ?

Woocommerce Custom product fields need to be editable after purchase in View Orders Page

I am Using https://stackoverflow.com/questions/46612499/display-a-custom-field-value-in-woocommerce-orders-edit-view/#answer-46615303 answer code, which works fine.

I want to display that checkout custom fields on My Account > View Order Pages, to allow customer to edit its value after purchase, so Customers can change and save the custom field value.

Any help?

CPT email notification including only new value custom fields

I have a custom post type «teams» with a set of different custom fields (ACF). I’m not a big coder, but hope to get some guidance in how to create a function that sends an email including ACF every time one of the teams (CPT) is updated by a WP-user.

I’ve found plugins that accomplish this, but unfortunately I need a bit more complex solution. The problem is the email should ONLY include custom fields that actually has changed. So I need to loop through and check each custom field for any change, and then only include the fields that has a new value in the final email.

I guess I’m asking if this is a very difficult task, or could it be done in a rather simple way? All sources would be very appreciated!

Display Custom Fields Meta Box on Category, Tags and CPT

I want to Add Custom Field on All Tags, Category and Custom Post Type (Taxonomy) but with below code get custom field option only on All Category. How to get on All Tags, Categories and CPT Taxonomy as well?

function wecode_category_fields($  taxonomies) {          if (current_filter() == 'category_edit_form_fields') {               $  Pincode = get_term_meta( $  taxonomies->term_id, 'Pincode', true );               ?>                  <tr class="form-field">         <th valign="top" scope="row"><label for="Pincode"><?php _e('Pincode'); ?></label></th>            <td>               <input type="text" size="40" value="<?php echo esc_attr( $  Pincode ) ? esc_attr( $  Pincode ) : ''; ?>"  name="Pincode"><br/>                   <span class="description"><?php _e('Please enter your Pincode'); ?></span>            </td>         </tr>                     <?php } elseif (current_filter() == 'category_add_form_fields') {             ?>              <div class="form-field">                 <label for="Pincode"><?php _e('Pincode'); ?></label>                 <input type="text" size="40" value=""  name="Pincode">                 <p class="description"><?php _e('Please enter your Pincode'); ?></p>             </div>                 <?php         } }          add_action('category_edit_form_fields', 'wecode_category_fields', 10, 2);     add_action('category_add_form_fields', 'wecode_category_fields', 10, 2);           function wecode_save_category_fields($  term_id) {         if ( isset( $  _REQUEST['Pincode'] ) ) {              $  Pincode = $  _REQUEST['Pincode'];                                   update_term_meta( $  term_id, 'Pincode', $  Pincode );            }  }     add_action('edited_category', 'wecode_save_category_fields', 10, 2);     add_action('create_category', 'wecode_save_category_fields', 10, 2);  

Read specific fields from Postgres jsonb

I have data like

{"name": "a", "scope": "1", "items": [{"code": "x", "description": "xd"}, {"code": "x2", "description": "xd2"}]} {"name": "b", "scope": "2", "items": [{"code": "x", "description": "xd"}]} {"name": "c", "scope": "3", "items": [{"code": "x", "description": "xd"}]} {"name": "d", "scope": "4", "items": [{"code": "x", "description": "xd"}]} 

Now I want the result like:

{"name": "a","items": [{"code": "x"}, {"code": "x2"}]} {"name": "b","items": [{"code": "x"}]} {"name": "c","items": [{"code": "x"}]} {"name": "d","items": [{"code": "x"}]} 

House rules for Force Fields

We are thinking about changing the rules for Force Fields in our Rogue Trader RPG as we see some problems:

  • The percentage is rather cumbersome and adds a lot of rolling dices during the combat.
  • The "complete or no" negation is an issue. With that kind of rules, a Force Field can completely negate the shots of tanks or even titans for several rounds, specially the stronger fields like the Eldar Force Field with a shield rating of 75.
  • It doesn’t really match with the fluff. Goge Vandire had himself shot and was protected only by a force field, a risk he’d probably not have taken if the Rosarius only had a 50% chance of stopping the shot.

Has anybody created house rules for those shield in order to address these issues? I’ve found a discussion in the FFG forum and there are some interesting suggestions but in the end, they all lack of the problems mentioned above.

We’ve thought about a fixed number of hit points for each shield but a member of the party is not happy about that. I therefore thought somebody here might have an idea on how to solve the issue. Suggestions from other systems using force fields are also very welcome.

Edit Comments Fields

I need to edit the comments fields.

1 – The metadata should be only date; 2 – The comment itself should be trimmed; 3 – the word ‘says’ next to the name should be gone;

I believe I can manage the logics, however I do not know how to get these fields, apply the logic, and return them.

enter image description here

<article id="div-comment-5" class="comment-body">                 <footer class="comment-meta">                     <div class="comment-author vcard">                         <img alt="" src="http://1.gravatar.com/avatar/710dade4711ee07ca27e7db85255b701?s=50&amp;d=mm&amp;r=g" srcset="http://1.gravatar.com/avatar/710dade4711ee07ca27e7db85255b701?s=100&amp;d=mm&amp;r=g 2x" class="avatar avatar-50 photo" height="50" width="50" loading="lazy">                        <b class="fn"><a href="http://mundo.local" rel="external nofollow ugc" class="url">Stefano Monteiro</a></b> <span class="says">says:</span>                 </div><!-- .comment-author -->                      <div class="comment-metadata">                         <a href="http://mundo.local/videos/music-classic-canada-37/#comment-5"><time datetime="2021-01-21T17:59:16+00:00">January 21, 2021 at 5:59 pm</time></a> <span class="edit-link"><a class="comment-edit-link" href="http://mundo.local/wp-admin/comment.php?action=editcomment&amp;c=5">Edit</a></span>                 </div><!-- .comment-metadata -->                                      </footer><!-- .comment-meta -->                  <div class="comment-content">                     <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod  tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>                 </div><!-- .comment-content -->                  <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://mundo.local/videos/music-classic-canada-37/?replytocom=5#respond" data-commentid="5" data-postid="830" data-belowelement="div-comment-5" data-respondelement="respond" data-replyto="Reply to Stefano Monteiro" aria-label="Reply to Stefano Monteiro">Reply</a></div>   </article>