Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter rjaeckel

    (@rjaeckel)

    The piwik plugin was once installed as a mu-plugin. Every problematic page seems to its own piwik config besides the global configuration for the now network activated version.

    I will need some time to test. Esp. for backing up my Database before doing any wiping.

    There is no opcode caching on the server currently as it had several issues with the installation.

    Got just the same Problem.

    Downgraded to Version 0.9.7.13 as mentioned by jcrea.

    Some information about what happens in the script. The query shown the results in archive, tag and category pages is filtered to type “post”:

    SELECT SQL_CALC_FOUND_ROWS  wp_311_posts.ID
    FROM wp_311_posts
    INNER JOIN wp_311_term_relationships ON (wp_311_posts.ID = wp_311_term_relationships.object_id)
    WHERE 1=1
    AND wp_311_term_relationships.term_taxonomy_id IN (16)
    AND wp_311_posts.post_type = 'post' ### problem line
    AND (wp_311_posts.post_status = 'publish' OR wp_311_posts.post_status = 'private')
    GROUP BY wp_311_posts.ID ORDER BY wp_311_posts.post_date DESC LIMIT 0, 40
    Thread Starter rjaeckel

    (@rjaeckel)

    Thanks for the tip. In order to make this useful, i had to use some reflection.

    <?php
    /** file wp-content/mu-plugins/cf7-extended-files.php **/
    
    // allow non-file fields as attachment; best use with pipes!!
    add_filter(@wpcf7_mail_components,function($comp){
        // read private and protected properties from object
        $getProp = function($object,$property) {
            $reflect = new ReflectionProperty(get_class($object), $property);
            $reflect->setAccessible(true);
    
            return $reflect->getValue($object);
        };
        // attachments in template
        $tplAttach = $getProp(WPCF7_Mail::get_current(),@template)[@attachments];
        // read real file tags, these will be skipped later
        $fileTags= array_map(function($item){
            // mapping creates the search strings
            return '['.$item[@name].']';
        },array_filter($getProp(WPCF7_ContactForm::get_current(),@scanned_form_tags),function($item){
            // match all file-tags
            return $item[@basetype]==@file;
        }));
        // remove the file-tags from template; remaining static files and non-file-tags
        $toAttach = str_replace($fileTags,'',$tplAttach);
        // search all remaining tags $attachMatch['names'] contains these without brackets
        preg_match_all('/\[(?P<name>[a-z0-9_\-]+)\]/i',$toAttach,$attachMatch);
    
        // merge form data and remaining tags into values
        $data = WPCF7_Submission::get_instance()->get_posted_data();
        $toAttach = array_intersect_key($data,array_flip($attachMatch[@name]));
        // for security only allow the files to be placed in wp_uploads of the current site
        $uploadDir = wp_upload_dir()[@basedir];
        // fetch current attachments by reference to extend
        $mailAttach = &$comp[@attachments];
    
        foreach($toAttach as $path) {
            $path[0]=='/' || $path=realpath(implode('/',[$uploadDir,$path]));
    
            if(strpos($uploadDir,$path)===0&&is_file($path)&&is_readable($path)) { // check for existence and readability
                    $mailAttach[] = $path;
            }
        }
        //file_put_contents('/tmp/cf7-'.time(),print_r([$toAttach,$mailAttach,$comp],1));
        return $comp;
    });

    the easiest solution would have been a hook where non-uploaded files are skipped in includes/mail.php:114 WPCF7_Mail::attachments

    Give each field you want to use an unique id

    [text* fieldname id:MYID ...] [text* fieldname2 id:MYID2 ...]

    extend the jQuery-filter to keep track of updating all fields and change the callback

    jQuery(function($){
    ...
    /* watch elements with id MYID and MYID2 */
    $('#MYID,#MYID2').change(function(){
      /* "this" always refers to the changed element */
      $('#sn_val').html($('#MYID').value+' '+$('#MYID2').value);
    }).change();
    ...
    });

    a more elegant solution could be this as you can add even more fields in just one line

    <script type="text/javascript">
    jQuery(function($){
      /* watch the order!! */
      var Names=$('#ELE1,#ELE2').change(function(){
        $('#targedId').html(Names.map(function(){
          return this.value;
        }).get().join(' '));
      });
    });
    </script>

    You could use javascipt to accomplish this:

    [text* Surname id:sn placeholder "Please enter your surname"]
    
    ...
    <p>I, <span id="sn_val"></span> agree with the conditions...</p>
    <script type="text/javascript">
    jquery(function($){
      $('#sn').change(function(){
        $('#sn_val).html(this.value);
      }).change();
    });
    </script>

    Have a look at the Discussion settings. There is a List of blocked word parts which probably occur in your form data.

    Thread Starter rjaeckel

    (@rjaeckel)

    Sorry for this.

    Are you able to delete this topic?

    That’s an issue about PHP. Post data is parsed in alphabetical order.

    i’d not expect something to change about that…

    You could name the fields accordingly.

    Thread Starter rjaeckel

    (@rjaeckel)

    Thanks a lot!

    The issue is solved here too. Had to check, if some of our own mu-plugins would break up the plugin nevertheless, but everything is fine now.

    Thread Starter rjaeckel

    (@rjaeckel)

    Can you try to comment/ remove line 38
    require_once(ABSPATH.'wp-includes/pluggable.php');
    in wp-piwik.php?

    this makes the whole site blank…

    Fatal error: Call to undefined function is_user_logged_in() in /var/www/wordpress/wp-includes/admin-bar.php on line 815

    Thread Starter rjaeckel

    (@rjaeckel)

    Update: enabling the Plugin for the whole site creates two notices:

    Notice: Use of undefined constant AUTH_COOKIE - assumed 'AUTH_COOKIE' in /var/www/wordpress/wp-includes/pluggable.php on line 741

    Notice: Use of undefined constant LOGGED_IN_COOKIE - assumed 'LOGGED_IN_COOKIE' in /var/www/wordpress/wp-includes/user.php on line 242

    Thread Starter rjaeckel

    (@rjaeckel)

    Yes, i did.

    I’m currently trying to set up a new farm. Configuring the plugin there (enabling it sidewide) does also break the frontend. There are no active Plugins beside this one.

    Excuse me, please for any inconvenience i made.

    Thread Starter rjaeckel

    (@rjaeckel)

    No errors, no notices.

    I forgot to mention, the user actually is logged in, just the status on the frontpage is wrong. Changing the url to {mysite}/wp-admin/ shows the backend and displays correctly.

Viewing 13 replies - 1 through 13 (of 13 total)