Sirach
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Page not found in httpsTypo in ssl config was source of problem.
Forum: Fixing WordPress
In reply to: Page not found in httpsThanks, but did you catch the part about, “and is updated by Permalinks as changes are made.” What you suggest has already been tried many times. Your change results in Internal Server Error. I know the .htaccess is working and that it is generated and changed by WordPress as Permalinks are changed. I was really looking for some insight into how WordPress translates the GET URL into the correct page, or perhaps, how to troubleshoot that process. Or even why http and https get different results. Any thoughts on that process?
Forum: Fixing WordPress
In reply to: Page not found in httpsApache2. “the website.org.conf has AllowOverride All, and an .htaccess in the www folder that works and is updated by Permalinks as changes are made.”
Forum: Plugins
In reply to: [Participants Database] Confirming record with Email LinkI understand. This stuff is complicated. I wanted to have the user record marked “confirmed” when the member used the email link to VIEW his own record. You led me to create a plugin that marks “confirmed” when the user UPDATES the record. On further review I have created the plugin that sets “confirmed” to “yes” just because the user viewed the record. I have now figured this out.
Thanks for the system and the advice! Yours is a tremendous contribution to WordPress. Here are my two (2) corrected plugins:
Confirm on UPDATE
============================================================
<?php
/* Plugin Name: Participants Database Confirm on Non-admin Update
Description: Auto set confirmed=’yes’ when record is updated by user. */add_filter( ‘pdb-before_submit_update’, ‘pdb_set_record_confirmed’ );
/**
* @param array $post the submitted record data
* @return array the new record data
*/
function pdb_set_record_confirmed( $post )
{
if ( is_admin() ) {
/** if we are the admin do nothing and return */
return $post;
}
/* ACTION FOR SET RECORD CONFIRMED: */$recrd_id = $post[‘id’];
global $wpdb;
$table1 = “wp_participants_database”;
$sql1 = “SELECT confirmed FROM $table1 WHERE id=$recrd_id”;
$sql2 = “UPDATE participants_database SET confirmed=’yes’ WHERE id=$recrd_id;”;$confirm = $wpdb->get_var($sql1);
if ( $confirm !== “yes” ) {
$result = $wpdb->update(
$table1,
array(
‘confirmed’ => ‘yes’ // string
),
array( ‘id’ => $recrd_id ));
}
return $post; /* * return updated array */
} / end of function
?>
===============================================================Confirm when Non-Admin User VIEWS Record:
=============================================================
<?php
/* Plugin Name: Participants Database Set Variable upon View by Non-admin user.
Description: Auto set confirmed=’yes’ when record viewed by user. */add_filter( ‘pdb-shortcode_call_pdb_record’, ‘pdb_set_record_confirmd’ );
/**
* @param array $post the submitted record data
* @return array the new record data
*/
function pdb_set_record_confirmd( $poste )
{
if ( is_admin() ) {
/** if we are the admin do nothing and return */
return $poste;
}
/* ACTION FOR SET RECORD CONFIRMED: */
$record_id = false;
// get the pid from the get string if given (for backwards compatibility)
$get_pid = filter_input(INPUT_GET, ‘pid’, FILTER_SANITIZE_STRING);
if (empty($get_pid)) {
$get_pid = filter_input(INPUT_POST, ‘pid’, FILTER_SANITIZE_STRING);
}
if (!empty($get_pid)) {
$record_id = Participants_Db::get_participant_id($get_pid);
}
if ( empty( $record_id ) ) {
return $poste;
}
if ( $record_id === false ) {
return $poste;
}global $wpdb;
$table1 = “wp_participants_database”;
$sql1 = “SELECT confirmed FROM $table1 WHERE id=$record_id”;
$sql2 = “UPDATE participants_database SET confirmed=’yes’ WHERE id=$record_id;”;
$confirm = $wpdb->get_var( $sql1 );if ( $confirm !== “yes” ) {
$result = $wpdb->update(
$table1,
array( ‘confirmed’ => ‘yes’ ),
array( ‘id’ => $record_id )
);
}return $poste; /* * return updated record */
} // end of function
?>
================================================================Hope there aren’t any bugs!
Forum: Plugins
In reply to: [Participants Database] Confirming record with Email LinkAny suggestions?
Forum: Plugins
In reply to: [Participants Database] Confirming record with Email Linkpid_in is correct, but neither of these lines work:
$rec_id = filter_input( INPUT_GET, Participants_Db::get_participant_id(‘$pid_in’), FILTER_SANITIZE_STRING );
or in the alternative:
$rec_id = Participants_Db::get_participant_id(‘$pid_in’);
Not sure how to diagnose this one…
Forum: Plugins
In reply to: [Participants Database] Confirming record with Email LinkOk, so I have attempted to update the record when a non-admin user views the record. Below is the code I cam up with. No errors reported, but it does not set the variable. Any hint what might be wrong?
Here’s the attempt at the plugin:
================================================================
<?php
/* Plugin Name: Participants Database Set Variable upon View by Non-admin user.
Description: Auto set confirmed=’yes’ when record viewed by user. */
add_filter( ‘pdb-shortcode_call_pdb_record’, ‘pdb_set_record_confirmd’ );
/**
* @param array $post the submitted record data
* @return array the new record data
*/
function pdb_set_record_confirmd( $poste )
{
if ( is_admin() ) {
/** if we are the admin do nothing and return */
return $poste;
}
/* ACTION FOR SET RECORD CONFIRMED: */
$pid_in = $_GET[‘pid’];
$rec_id = false;
// get the record id from the get pid if given
$rec_id = filter_input( INPUT_GET, Participants_Db::get_participant_id(‘$pid_in’), FILTER_SANITIZE_STRING );
if ( empty( $rec_id ) ) {
return $poste;
}
if ( $rec_id === false ) {
return $poste;
}
global $wpdb;
$table1 = “wp_participants_database”;
$sql1 = “SELECT confirmed FROM $table1 WHERE id=$rec_id”;
$sql2 = “UPDATE participants_database SET confirmed=’yes’ WHERE id=$rec_id;”;
$confirm = $wpdb->get_var( $sql1 );
if ( $confirm !== “yes” ) {
$result = $wpdb->update(
$table1,
array( ‘confirmed’ => ‘yes’ ),
array( ‘id’ => $rec_id )
);
}
return $poste; /* * return updated record */
} // end of function
?>
===============================================================================Forum: Plugins
In reply to: [Participants Database] Confirming record with Email LinkAll that work for nothin’. Shucks.
Can you translate this:
“use the ‘pdb-shortcode_call_pdb_record’ filter to record the view”
into English? (-;
What do you mean by “record the view”?So if I get the attributes and record ID, how do I set confirmed = “yes”? Sorry, I’m not getting it.
Forum: Plugins
In reply to: [Participants Database] Confirming record with Email LinkBe patient! My first time in PHP beyond “Hello, World”. Thanks very much for the advice.
The code below seems to work, but it does not update when the record is viewed, but ONLY if the record viewer clicks the update button.
Can it be made to confirm when viewed via email link? Thanks again!My revised plugin code:
================================================================
<?php
/* Plugin Name: Participants Database Confirm When viewed Email link
Description: Auto set confirmed = ‘yes’ when record is accessed by user. */add_filter( ‘pdb-before_submit_update’, ‘pdb_set_record_confirmed’ );
/**
* @param array $post the submitted record data
* @return array the new record data
*/
function pdb_set_record_confirmed( $post )
{
if ( is_admin() ) {
/** if we are the admin do nothing and return */
return;
}
/* ACTION FOR SET RECORD CONFIRMED: */$recrd_id = $post[‘id’];
global $wpdb;
$table1 = “wp_participants_database”;
$sql1 = “SELECT confirmed FROM $table1 WHERE id=$recrd_id”;
$sql2 = “UPDATE participants_database SET confirmed=’yes’ WHERE id=$recrd_id;”;$confirm = $wpdb->get_var($sql1);
if ( $confirm !== “yes” ) {
$result = $wpdb->update(
$table1,
array(
‘confirmed’ => ‘yes’ // string
),
array( ‘id’ => $recrd_id ));
}
return $post; /* * return updated array */
}
===============================================================Forum: Plugins
In reply to: [Participants Database] Confirming record with Email LinkTried to follow the guides to create a plugin. Code below.
Using “self::” gets white screen;
syntax check gets a php7 error “Cannot use “self” when no class scope is active in your code”Using php5 syntax check gets error “Using $this when not in object context”
In either event plugin does not work. It does not update the field ‘confirmed’.Suggestions? What am I missing?
My attempted plugin contribution:
==========================================================
<?php
/* Plugin Name: Participants Database Confirm Record by Email
Description: Auto set confirmed = ‘yes’ when their record is first accessed by user. */add_filter( ‘pdb-before_submit_update’, ‘pdb_set_record_confirmed’ );
/**
* @param array $post the submitted record data
* @return array the new record data
*/
function pdb_set_record_confirmed( $recrd_id )
{
if ( is_admin() ) {
/** if we are the admin do nothing and return */
return;
}
/* ACTION FOR SET RECORD CONFIRMED: */$recrd_id = false;
// get the pid from the get string if given
$get_pid = filter_input( INPUT_GET, Participants_Db::$record_query, FILTER_SANITIZE_STRING );if ( empty( $get_pid ) ) {
$get_pid = filter_input( INPUT_POST, Participants_Db::$record_query, FILTER_SANITIZE_STRING );
}
if ( !empty( $get_pid ) ) {
$recrd_id = self::get_participant_id( $get_pid );
}
if ( $recrd_id === false ) {
$recrd_id = self::$session->record_id( true );
}global $wpdb;
$table1 = “wp_participants_database”;
$sql1 = “SELECT confirmed FROM $table1 WHERE id=$recrd_id”;
$sql2 = “UPDATE participants_database SET confirmed=’yes’ WHERE id=$recrd_id;”;$confirm = $wpdb->get_var($sql1);
if ( $confirm !== “yes” ) {
$result = $wpdb->update(
$table1,
array(
‘confirmed’ => ‘yes’ // string
),
array( ‘id’ => $recrd_id ));
} else {
$result = “Already set”;
}
return $result; /* * return what? */
}
==============================================================Forum: Plugins
In reply to: [Participants Database] Confirming record with Email LinkI’ll check it out. Thanks!