wp query – how to include author in custom post type search

I have a search field where a user can type in something to search a custom post type. This works okay if the word exists in the title but not in the content. Also, I want to include authors in the search so if they type in an author name, if they created a record for that post type it will also show the records. Is that possible?

$searchTerm = $_GET('s');
$args = array(
    'post_type' => 'mycpt',
    's' => $searchTerm
);

$the_query = new WP_Query( $args );

if ( $the_query->have_posts() ) {

    while ( $the_query->have_posts() ) : $the_query->the_post(); 
        the_title() . '<br>';
    endwhile;

} else {
        echo 'no posts found';
}
wp_reset_postdata();

gmail – Is the author of Microsoft Outlook calendar invitations notified when I invite others from the resulting Google Calendar invite

In my Gmail account, when I receive a Outlook calendar invite (in the form of an .ics file attachment which is using iCalendar format), and then forward that even to a different Gmail account, I do not want the identity of that second Gmail account to be shared with the original author of the Outlook calendar invite. My testing shows that it does indeed work just like that, but I want to know if it is guaranteed to work like that, or whether or not I’m relying upon a bug in Googles handling of this specific type of invite sharing scenario.

Here is my test sequence:

  1. Using my Microsoft Outlook account, I created a calendar event inside Microsoft Outlook, and sent it to my personal Gmail account at a@gmail.com.
  2. When I received the event in Gmail, I clicked Yes to rsvp from that a@gmail.com account.
  3. From my a@gmail.com account, I then clicked on the event inside Google Calendar, and clicked on the pencil icon to edit it.
  4. I then added b@gmail.com to the invite list. At this point I noticed the question mark icon and clicked it, and read the verbiage (see screenshot below with the red underlined text), and clicked save.
  5. In the b@gmail.com I received the email there and clicked “Yes” in the email.

I then checked my original Outlook Calendar entry, and not once did I see any mention of b@gmail.com

But is it intended to work that way? See screenshot below.

enter image description here

php – WP query posts BUT show the most recent and one per author

I want to display 12 articles first goes the latest BUT i want to show only one post per user. For example if user A wrote 2 artticles today i want to display only the latest of his articles.

Here is the query i use

<?php
                
        //the array 1
                $args = array(
                /*'posts_per_page' => 12, /* how many post you need to display */
                'offset' => 0,
                'orderby' => 'post_date',
                'order' => 'DESC',
                'post_type' => 'blog', /* your post type name */
                'post_status' => 'publish',
                
            );

            $query1 = new WP_Query($args);           
        ?>

Display Author Registration Date – WordPress Development Stack Exchange

In author archive, I want to show author registration date in the following format:

January 16, 2021

I have found this code:

$user_ID = $post->post_author;
echo the_author_meta( 'user_registered', $user_ID );

But its output format is:

2021-01-16 10:40:52

How can I strip off time and get my desired format?

I am using date format F j, Y

WordPress Posts Multi Author without using plugin

I am trying to code a PHP page which I can allow multiple authors for posts.

At first I have my pageAuthors.php page, it allows me to choose my post and check for available authors. It is a simple form with an action that redirects it to a page showAuthors.php.

After being on showAuthors.php, you’ll have the post you choosed and the available authors in a checkbox with the publisher automatically checked.

You can check other authors for being co-authors.

Everything is okay but I dont know the query I should write to access different tables in the database.

I searched and found that I should at first:

  • Register a taxonomy using an array.
  • Update post count for published users.

pageAuthors.php

showAuthors.php

All I need is the query to make give access to the other author to the and let him edit it.


Some useful links:

Where is Author Data Stored in the Database?

Where are WordPress Users and Permissions Stored in the Database?

8 – Change the role of the author of a node when it is published

How to change the role of the author of a node when this node is published?

The scenario is as follows:

The user has the role A, he posts a node, not published by default.

The node is published, the user obtains the role B.

I have tried to achieve this with Rules.

Event: after updating a node

But for condition and action, I tried different solutions for data picker (author): node.uid, node.uid.entity.uid.value, but there are errors “Expected a entity: user data type for context User but got …”

Do you know how to do this?

Database design: use a single “Author” associative entity related to different entities

Let’s say my application deals with multiple entities (Articles, Files, Images, Documents, …).

I also have multiple Users (another entity).

Every entity must have one or more “Author” User(s) associated to it.

Build a ManyToMany relation between each entity and the User table.

  • Articles <–> Articles_Users <–> Users
  • Files <–> Files_Users <–> Users

This is a “classic” approach. The main advantage for me (a HUGE one!) is that you can enforce foreign key and be sure, database-level, that the relation is sound.

The main con is that this requires a different table for each new entity type. This plain sucks on oh-so-many-levels.

The second design is to build just a single associative entity with and additional field to map each record to its correct entity:

| entity_id | user_id | entity_type

The main pro here is that you don’t need a new associative entity for every relation. This is a HUGE pro for me and I like this design much better.

The main con is that you cannot manage foreign keys checks at the database level. Yes, I can do it at the application level, but it’s not as solid.

So… which one should I go for? Would the second one be a good practice or would it be consider a bad design?

development – Using AweCsome Framework to override sharepoint user fields (Author)?

I need to create/update one item in SharePoint using AweCsome Framework (https://github.com/OleAlbers/aweCsome) changing author field.

How can I do this?

When I try to accomplish i define the entity field like this (ex AnyEntityBO):

public String Author { get; set; }

i got the item, modified author field and save:

IAweCsomeTable awecsomeTable = new AweCsomeTable(context);
AnyEntityBO anyEntity= awecsomeTable.SelectItemById<AnyEntityBO>(1);
anyEntity.Author = "xxx@xxx.onmicrosoft.com";
awecsomeTable.UpdateItem<AnyEntityBO>(anyEntity);

When I saved the item I got the error:

Invalid data has been used to update the list item. The field you are trying to update may be read only

Help please!