Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter wp5le

    (@wp5le)

    and as filter: filter=”field=getLastPathSegment” ?

    That doesn’t works ..

    Plugin Author Michael Simpson

    (@msimpson)

    filter="field=getLastPathSegment()"

    Thread Starter wp5le

    (@wp5le)

    so so sorry … no it still doesn’t works..

    i use this:

    require_once(ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CFDBPermittedFunctions.php');
    
    function getLastPathSegment($url) {
    $path = parse_url($url, PHP_URL_PATH);
    $pathTrimmed = trim($path, '/');
    $pathTokens = explode('/', $pathTrimmed);
    if (substr($path, -1) !== '/') {
    array_pop($pathTokens);
    }
    return end($pathTokens);
    }
    
    cfdb_register_function('getLastPathSegment');

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]

    and inside the website i use:
    [cfdb-html form="test" filter="field1=getLastPathSegment()"]${Submitted}[/cfdb-html]

    static is working
    [cfdb-html form="test" filter="field1=ball"]${Submitted}[/cfdb-html]

    .. what am i doing wrong? .. i’m sorry

    Plugin Author Michael Simpson

    (@msimpson)

    I suggest make you function return “ball” for the moment. Make sure that works. If it doesn’t, then we need to figure out what it is not calling your function. If it does, then you have to sort out what is wrong in your code.

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘[CFDB plugin] Part of URL as filter’ is closed to new replies.