WP-Members: Membership Framework
[resolved] [Plugin: WP-Members] add_filter ‘wpmem_login_links’ not working (4 posts)

  1. scioto_sam
    Posted 4 years ago #

    I am using TwentyEleven Child theme with WP-Members 2.7.3. I want to keep member pages/posts invisible until member is logged in. I have separate login page and am trying to display member links after successful login on this page. The method I am using is add_filter for the hook, wpmem_login_links, as explained in the WP Members User Guide, Section: Action and Filter Hooks. The function is stored in the child theme's functions.php file. No matter what code I put into the function, all that is displayed on the login page is the default message:

    You are logged in as user-name
    click here to logout

    Here is the code snippet from functions.php:

    function custom_login_links( $string ) {
    $string = "<p>First Link</p>" . $string;
    $string = $string . "<p>Last Link</p>";
    return $string;
    add_filter( ‘wpmem_login_links’, ‘custom_login_links’ );

    Any help would be appreciated.

    Plugin: wp-members

  2. jevets
    Posted 4 years ago #

    Try sending more arguments to add_filter:

    add_filter( ‘wpmem_login_links’, ‘custom_login_links’ , 10, 1);

    The last 1 tells the system to send 1 argument to the callback.

  3. Chad Butler
    Plugin Author

    Posted 4 years ago #

    Check the single quotes in add_filter. They do not appear to be encoded properly.

    add_filter( 'wpmem_login_links', 'custom_login_links' );

  4. scioto_sam
    Posted 4 years ago #

    Jevets - thanks for the reference...
    Chad - Great plugin & thanks for all the hard work. You are right about the single quotes! I changed them and the login page now shows the additional links.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Members: Membership Framework
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic