WordPress.org

Forums

function call change splice / str_replace or ? (1 post)

  1. Ptryk
    Member
    Posted 9 years ago #

    have begun to create a something to limit number of tries on password protected posts/pages (maybe admin even!?) that i would like to make as a plugin
    http://wordpress.org/support/topic/41340

    worked up some code.. don't want to just hack the wp-pass.php and template-funcitons-post.php (not very pluginable, then?!) the easiest is to replace the function call of ln64 of tempate_functions-post-php


    $output = get_the_password_form();

    to call my function .. eg

    $output = gt_th_psswrd_frm_authentification();

    and that function would then call my modified wp-pass.php called something else.. etc etc..

    does anyone know any good methods to make this happen?

    one way i have seen is the splice/replace done is with "str_replace" but in that instance it seems this is accomplished with strings (text within ' ' ) & i am having trouble getting it to work to replace the function name!?

    tried like this..


    function add_post_password_authentification ($output) {
    $output = get_the_password_form();
    $output = str_replace (
    get_the_password_form(),
    gt_th_psswrd_frm_authentification(),
    $output);
    return $output;
    }

    but, to no avail... seems like it should / could work..
    http://se2.php.net/manual/en/function.str-replace.php

    any ideas? of course, other suggestions or directions are appreciated, i just want this to work (as a plugin!)

Topic Closed

This topic has been closed to new replies.

About this Topic