php – I want to insert a link inside a tag page that will link to another page tag

Could someone help me?

I want to insert a link inside a tag page that will link to another page tag.

This is the code (on the answer paragraph):

Link from tags to tag pages displaying all posts with that tag

However, the code is always picking the same tag for linking the page tag to another page tag.

I would like to modify the code so it will randomly pick the tag and link to it.

Is there a way to do this?

sharepoint online – Why can’t insert data to Custom List?

I create a Custom List from AddIns

enter image description here

I had use Page : Lists/QuanLyWorkFlow/AllItems.aspx and checked it insert data ok.
enter image description here

But If i use code to insert from my addins:

var phongbanid = $("#cboDepartment").val();
var status_from = $("#cboStatus_From").val();
var status_to = $("#cboStatus_To").val();
var member_id = $("#cboMember").val();  
var email_to = $("#txtEmail_To").val(); 
var CC = $("#txtEmail_CC").val(); 
var BCC = $("#txtEmail_BCC").val(); 
var email_Title = $("#txtEmail_Title").val(); 
var email_body = $("#txtEmail_Body").val(); 
 var oList = clientContext.get_web().get_lists().getByTitle('QuanLyWorkFlow');
    var itemCreateInfo = new SP.ListItemCreationInformation();
    var oListItem = oList.addItem(itemCreateInfo);
    oListItem.set_item('PhongBan', phongbanid);
    oListItem.set_item('Status_From', status_from);
    oListItem.set_item('Status_To', status_to);
    oListItem.set_item('Member', member_id);
    oListItem.set_item('EmailTo', email_to);
    oListItem.set_item('EmailCC', CC);
    oListItem.set_item('EmailBCC', BCC);
    oListItem.set_item('EmailTitle', email_Title);
    oListItem.set_item('EmailBody', email_body);
    oListItem.update();
    clientContext.load(oListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, function (sender, args) {
        alert('Item created: ' + oListItem.get_id());            
    }), Function.createDelegate(this, function (sender, args) {
        alert('Request failed. ' + args.get_message() + 'n' + args.get_stackTrace());
    }));

It occur error:

"Column 'EmailTo' does not exist. It may have been deleted by another user.  /sites/demo/SharePointAddIn2/Lists/QuanLyWorkFlow"

But If i close columns: EmailTo, EmailCC,EmailBCC, EmailTitle, EmailBody , it is ok.

Why i can’t insert data to columns: EmailTo, EmailCC,EmailBCC, EmailTitle, EmailBody?

8 – How to insert custom redirect script in index.php without losing it on update

At the moment I’m migrating an old site to Drupal. To redirect all old url’s to new ones, I made a script that has to be inserted before anything goes off, so in index.php at the top.

   <?php

    include 'custom.php';

    use DrupalCoreDrupalKernel;
    use SymfonyComponentHttpFoundationRequest;
    etc.etc.

All is fine until an update wipes this out.
Could (should?) it be done some other way to preserve this?

postgresql – Postgres insert query automation

In our organization, we are creating a new table where all the employees’ tasks, time spent on a task, and various fields will be there, basically an activity tracking table, from which we can extract some data as we have some tools for data visualisation.

Some of the team members don’t have Postgres experience at all. We currently have two ways, upload the CSV and give the specific query so that they can update the table.. but both of them are manual tasks, so, Is there any way or tool through which these insertions can be automated and easy for all.

plugin development – Data not insert and update through ajax and jQuery in admin page?

I made custom plugin and done crud operation, display all data in admin page, used ajax and jquery. Data successfully deleted but not inserted or updated. Data successfully pass through ajax but not inserted.
Also What I saw if input block is empty and I put some data and updated it. It got first row data.
Error- https://prnt.sc/wnzqjr
ajax for insert the data

jQuery('.ins_btn').click(function(){
        var id = jQuery(this).attr('data-id');
        var question = jQuery('#question').val();
        var answer = jQuery('#answer').val();
        // alert(id);
        $.ajax({
            url: '<?php echo admin_url('admin-ajax.php');?>', 
            type: 'POST',
            data:{ 
              action: 'insert_records', 
              insert_record : id,
              insert_question: question,
              insert_answer: answer
            },
            success: function( data ){
                alert("Records are successfully insert");
                location.reload();
            }
         });
    });

insert query

 function insert_records(){
  global $wpdb;
 $id = $_POST('insert_record');
 $question = $_POST('insert_question');
 $answer = $_POST('insert_answer');


  $db_inserted = $wpdb->insert( $wpdb->prefix.'faqq', 
        array( 'ID' => $id, 
               'question' => $question, 
               'answer' => $answer) 
    );
}
add_action( "wp_ajax_insert_records", "insert_records" );
add_action( "wp_ajax_nopriv_insert_records", "insert_records" );

ajax for update the data

jQuery('.upd_btn').click(function(){
        var id = jQuery(this).attr('data-id');
        var question = jQuery('#question').val();
        var answer = jQuery('#answer').val();
        alert(question);
        $.ajax({
            url: '<?php echo admin_url('admin-ajax.php');?>', 
            type: 'POST',
            data:{ 
              action: 'update_records', 
              update_record : id,
              update_question : question,
              update_answer : answer

            },
            success: function( data ){
                alert("Records are successfully updated");
                location.reload();
            }
         });
    });

update query

function update_records(){
  global $wpdb;
  // $table_name = $wpdb->prefix.'faqq';
  $id = $_POST('update_record');
  $question = $_POST('update_question');
  $answer = $_POST('update_answer');
  $db_updated = $wpdb->update( $wpdb->prefix.'faqq', 
        array('question'    => $question,
              'answer'   => $answer, array( 'ID' => $id ) )
          ); 
}

Here are some errors.
1)Getting error when update the data through ajax- https://prnt.sc/wnymkx
– https://prnt.sc/wnyos5
– https://prnt.sc/wnyuhk

Why does wp_insert_term insert 2 terms when using dynamic slug

I’d like to dynamically generate the slug for a term. But I always end up with 2 entries in the database.

I came up this minimal working example:
When I run this code below, I end up with 2 entries in the database

e.g.

term_id  name   slug  
284      test   list-66603_1610659731  
285      test   list-29853_1610659732
function test_submit_list()
{
    $slug = 'list-'. random_int(1,100000) .'_'. time();

    $term = wp_insert_term(
        'test',
        'list',
        array(
            'description' => 'Slug: "'.$slug.'"',
            'slug'        => $slug,
            'parent'      => 25,
            )
    );
}

The function is called by an AJAX:

$("#list-form").on('submit', function(e) {
        e.preventDefault();

        var form = {
            action: 'test_submit_list',
        };

        $.post(test_obj.ajax_url, form).always(function(data) {
            console.log(data);
        });
    });


When I change the first line to $slug = 'list-'. 12345 .'_'. 11111111;, I only get one entry.

Can someone please explain to me what is going on? This is driving me crazy.

javascript – Not able to insert data into TaskList In sharepoint Spfx

Using SP-Pnp-Js Library, I am not able to insert data from a webpart into the sharepoint Tasklist.

private SubmitWorkflowForm(): void {

var TaskNameVal = document.getElementById('taskName')('value');
var StartDateVal = document.getElementById('startDate')('value');
var DueDateVal = document.getElementById('dueDate')('value');
var AssignedToVal = document.getElementById('assignedTo')('value');
var CompleteVal = document.getElementById('complete')('value');
var DescriptionVal = document.getElementById('description')('value');
var PriorityVal = document.getElementById('priority')('value');
var statusVal = document.getElementById('Status')('value');

const siteurl: string = this.context.pageContext.site.absoluteUrl + "/_api/web/lists/getbytitle('TestTask')/items";
pnp.sp.web.lists.getByTitle("TestTask").items.add({
  Title: TaskNameVal,
  StartDate: StartDateVal,
  DueDate: DueDateVal,
  PercentComplete: CompleteVal,
  AssignedTo: AssignedToVal,
  Body: DescriptionVal,
  Priority: PriorityVal,
  Status: statusVal,
}).then(r => {
  alert('Success')
  $("input").val("")
  location.reload();
})
}

In the AssignedTo variable, I am using the “Users Email’s value

Error-
“value”:”A ‘PrimitiveValue’ node with non-null value was found when trying to read the value of a navigation property; however, a ‘StartArray’ node, a ‘StartObject’ node, or a ‘PrimitiveValue’ node with null value was expected.”

Insert custom data to custom table on wordpress database

i need some help here

i wanna create some form for user to subscribe our article and store the data to database. i have tried to search it on google, but nothing worked when i tried that. i know that some plugin can do that but i dont know how to create the validation when user already subscribed and the form never show again.

how do i do to insert the data to my database?
hope you guys understand what the problem and any help will appreciate

thank you

here is my code

the form

                    <form action="<?php echo site_url() . '/insert-data.php'; ?>" method="POST" name="form-subscribe">
                        <div class="row">
                            <div class="col-12 col-lg-12 col-md-12">
                                <p>Name*</p>
                                <input type="text" name="subs_name" placeholder="Full Name*" required="">                               
                            </div>
                        </div>
                        <div class="row mt-3">
                            <div class="col-12 col-lg-12 col-md-12">
                                <p>Email*</p>
                                <input type="text" name="subs_email" placeholder="Email Address*" required="">                              
                            </div>
                        </div>
                        <div class="row mt-3">
                            <div class="col-12 col-lg-12 col-md-12">
                                <p><button type="submit" class="btn btn-primary" name="submitForm">Submit</button></p>
                            </div>
                        </div>
                    </form>

the action file aka insert-data.php

<?php

    //setting up the form
    function insertuser() {

      $name   = $_POST('subs_name');
      $email  = $_POST('subs_email');  

      global $wpdb; 
      $table_name = $wpdb->prefix . "subscriber";
      $wpdb->insert($table_name, array('subs_name' => $name, 'subs_email' => $email) );
      }

if( isset($_POST('submitForm')) ) insertuser();

?>

Here is the table of wp_subscriber
enter image description here