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?

copy postgresql db rows from one table to another depending on an id

I want to restructure my database. Therefore I want to move some columns from one table to another. The problem is that I do not want to simply insert the new column somehow into the destinationtable. Both tables have an id and I want to copy the column data depending on the id of both tables.

Table1:

id bigint not null a character varying b date ... 

Table2:

id bigint not null c character varying d date ... 

I have tried with insert into to no avail because this would add new rows in the destination table which is not what I want. Same with select into.

insert into table2 as t2 (c,d) select t1.a, t1.b from table1 as t1 where t1.id = t2.id 

PostgreSQL COPY TO doesn’t honor Linux group privileges

I have issues executing COPY to command, receiving below error msg:

ERROR: could not open file "/home/pgsql/TMP/out.txt" for writing: Permission denied

  • Postgres engine is being run as postgres user
  • Postgres user belongs to app group
  • TMP folder has below priviledges set:

drwxrws— 2 pgsql app 23 Mar 28 19:47 TMP

I don’t understand why it doesn’t work…

I did quick check login as postgres user and creating file and this worked:

sudo -i -u postgres

If I change priviledges to 777 all works as expected (I can do copy to command with no issues) So as to me it looks postgres doesn’t somehow honor Linux groups rights

Can someone guide me how to resolve that (777 is not an option to me…)

Can I use the Wizardly Quill to make a free copy of my actual Awakened Spellbook?

I know the Order of Scribes can already make a copy of the Awakened Spellbook by making the ritual in another blank book, but that leaves the old Awakened Spellbook in blank. I want to have both Spellbooks in hand for pure Roleplay.

Here’s the rules for Wizardly Quill from Tasha’s Cauldron of Everything:

As a bonus action, you can magically create a Tiny quill in your free hand. The magic quill has the following properties:

  • The quill doesn’t require ink. When you write with it, it produces ink in a color of your choice on the writing surface.

  • The time you must spend to copy a spell into your spell book equals 2 minutes per spell level if you use the quill for the transcription.

  • You can erase anything you write with the quill if you wave the feather over the text as a bonus action, provided the text is within 5 feet of you. This quill disappears if you create another one or if you die

Here’s the rules about replacing spellbooks from Player’s Handbook:

Replacing the Book. You can copy a spell from your own spellbook into another book— for example, if you want to make a backup copy of your spellbook. This is just like copying a new spell into your spellbook, but faster and easier, since you understand your own notation and already know how to cast the spell. You need spend only 1 hour and 10 gp for each level of the copied spell.

If I’m not wrong, I don’t need to spend nothing to test the spells I already know. Just need the right amount of ink and time to copy them. The Wizardly Quill is exactly made for this purpose of saving time and ink. That’s my interpretation. Am I wrong?

When I cast Simulacrum to make a copy of a creature with a feature like Rangers Companion, do I get a free animal companion to go with it?

The Simulacrum spell contains an interesting clause.

It appears to be the same as the original, but it has half the creature’s hit point maximum and is formed without any Equipment. Otherwise, the Illusion uses all the Statistics of the creature it duplicates.

Since the Companion feature is part of a creatures statistics, this means that it should get duplicated, I think. So if I were to duplicate a creature that has a feature like Rangers Companion (or something similar), does the animal companion automatically come with it?

Related questions that would have an answer based on the answer to the primary question:

  • If we don’t get a free companion, can the simulacra bond with a new one?

  • If we do get one, would it also be an illusion, or is it a real flesh-and-blood creature?

  • If the Simulacra dies, does the companion instantly die as well?

  • If the companion dies, can the Simulacra bond with a new companion?

How do I make ClickToCopy copy some text rather than string?

Consider the following example:

ClickToCopy["display text","file name"] 

When I click the display text I get "file name" rather than file name without the quotes. Which doesn’t serve my purpose of quick file name access. So when I copy to some location I have to manually remove the quotes.

What should I do to make it copy the actual Text inside the String?

How to copy an order item meta from the parent to the child order in a Woocommerce Subscription?

I’m running a function hooked to woocommerce_order_status_completed that uses an API to get a phone number and pin from an external source and save that in a meta key on some order items. Some of these order items are subscriptions.

When a Woocommerce subscription renewal order runs automatically, it fires the API and gets a new set of call-in data. I need to check if a completed order is a subscription renewal and if so skip the API call and just get the renewed item’s parent meta data and insert it into the child items meta.

The top portion of the code I have tried here is not working. The API call portion of the code in the else{} is working so I have truncated it.

add_action ( 'woocommerce_order_status_completed', 'add_item_meta_or_run_api', 10 , 1);  function add_item_meta_or_run_api( $  order_id ) {  $  order = wc_get_order( $  order_id );   if (wcs_order_contains_subscription( $  order, 'renewal' )){ //check if the order contains a renewal subscription    foreach ($  order->get_items() as $  item_id => $  item_obj) { //loop through each rewnewal item        $  parent_id = $  item_obj->get_parent_id(); // Get the parent order ID for the subscriptions.       $  parentSubscriptions = wcs_get_subscriptions_for_order( $  parent_id );//get parent order subscriptions                 foreach (  $  parentSubscriptions->get_items() as $  parent_item_id => $  subscription_item_obj) { //loop through parent order items and get the meta.                   $  ParentCallinData = $  subscription_item_obj->get_meta('call_in_data');               // Store parenent item call in data in renewal order item meta         wc_update_order_item_meta($  item_id,'call_in_data',   $  ParentCallinData, true);             }    } }   else {//if there is not a subscription renewal in the order then we run the Api       foreach ($  order->get_items() as $  item_id => $  item_obj) {    //Code here has been removed that builds and runs the API call to dynamically get the call-in data and store it in $  APIresponse          wc_update_order_item_meta($  item_id,'call_in_data',  $  APIresponse, true); //the APIresponse is added to an order item meta key     }    }   }