Forum Replies Created

Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter oneminduniv

    (@oneminduniv)

    Sorry, not very good with PHP. I put together this filter, but it is not working.

    `function replace_text($text) {
    $text = str_replace(‘woo_wallet_account_topup_menu_title’, ‘Add Money’, $text);
    return $text;
    }
    add_filter(‘the_content’, ‘replace_text’);

    Thank you

    Thread Starter oneminduniv

    (@oneminduniv)

    RE: That error is coming from the plugin “member-upgrade-notice”

    Yes, I created a plugin (vs adding code to functions.php) using your code from above, I just named the plugin member-upgrade-notice;

    add_filters('wt_user_allowed_posts' , 'my_custom_page');
    
    function my_custom_page($posts){
     return array(
    
       20 => // change your custom page id here
    
       get_post(20)
    );
    
    }

    And when I tried to activate the plugin I got the error notice above.

    I’m not very good with PHP, but I think the function > my_custom_page should be declared before the filter > add_filters(‘wt_user_allowed_posts’ , ‘my_custom_page’);

    Thank you

    Thread Starter oneminduniv

    (@oneminduniv)

    New errors

    Fatal error: Uncaught Error: Call to undefined function add_filters() in /home/www/xxxxxx.com/wp-content/plugins/member-upgrade-notice/member-upgrade-notice.php:12 Stack trace: #0 /home/www/xxxxxx.com/wp-admin/includes/plugin.php(1897): include() #1 /home/www/xxxxxx.com/wp-admin/plugins.php(172): plugin_sandbox_scrape(‘member-upgrade-…’) #2 {main} thrown in /home/www/xxxxxx.com/wp-content/plugins/member-upgrade-notice/member-upgrade-notice.php on line 12

    Thread Starter oneminduniv

    (@oneminduniv)

    Getting PHP errors with the snippet above.

    Parse error: syntax error, unexpected ‘&’ On line 13

    When I remove the extra “&” here > add_filters('wt_user_allowed_posts' , 'my_custom_page');

    I get > (T_STRING), expecting ‘(‘ On line 14`

    Never mind on the above; I took your code from the WP email that added &#039 in place of ‘
    But now that I have the code as you posted above, I’m getting new errors

    • This reply was modified 6 years, 10 months ago by oneminduniv.
    • This reply was modified 6 years, 10 months ago by oneminduniv.
    • This reply was modified 6 years, 10 months ago by oneminduniv.
    Thread Starter oneminduniv

    (@oneminduniv)

    Thank you for your reply.

    RE: Please use this filter wt_user_allowed_posts

    I do not see additional settings in the new plugin; Would I add the wt_user_allowed_posts to the functions.php file or may be create the filter as a plugin?

    I’m not sure how to write the filter; what I want to do is direct members that need to upgrade to access content to a custom upgrade page vs a 404 error. The upgrade page will be the same for all memberships.

    Thank again!

Viewing 5 replies - 16 through 20 (of 20 total)