WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] wrong link "Begin using the site" after login (4 posts)

  1. helirexi
    Member
    Posted 11 months ago #

    Hello Chad! Thanks for great plugin!
    I use last 2.8.5 wp-members and have wrong link "Begin using the site" at plugin's register page when user is already logged-in.
    I have installed wordpress single-site but in its own directory - "WordPress address (URL)http://site.com/wp/" and "Site address (URL)http://site.com"
    In file wp-members-dialogs.php at line 167 this link generated with code
    <li><a href="' . get_option('siteurl') . '">' . __( 'Begin using the site.', 'wp-members' ) . '</a></li>
    and there for I have at page wrong link 'http://site.com/wp/' but must be without subdirectory ".../wp/"
    All my site is working good (I install it after read this Codex). Permalinks also tuned.
    May I change this get_option('siteurl') to something or maybe this is wrong? I'm not a php-programmer - only learning :)
    Also have in my public folder, in file error_log this:
    PHP Warning: sprintf(): Too few arguments in /public_html/wp/wp-content/plugins/wp-members/wp-members-dialogs.php on line 164

    http://wordpress.org/plugins/wp-members/

  2. helirexi
    Member
    Posted 11 months ago #

    Changed in file wp-members-dialogs.php at line 167 this part get_option('siteurl') to this get_option('home')
    Now link "Begin using the site" at plugin's register page when user is already logged-in working as needed - refer to my "Home" page. But not sure that is correct - I'm totally noob in php.

  3. Chad Butler
    Member
    Plugin Author

    Posted 11 months ago #

    It is a bad practice to make direct edits to a plugin file. You risk breaking the plugin. The first thing that should come to your mind after "I'm not a php-programmer" should be "therefore, I should probably not be making changes to plugin core files." ;-) The other problem is that if you get in that habit, you will find yourself loathe to update a plugin because you'll need to redo all your edits (also known as hacks).

    I realize some plugins don't provide a framework for working around things that are in the plugin like this, but WP-Members provides a framework for customization via action/filter hooks and pluggable functions. These are the same elements you will find as part of WP's APIs.

    In this case, there is a filter available for those links, so that would be the approach you would want to take. I know you said you're a php noob, but trust me, this is a better practce than editing the plugin. You could use the filter to either dump the existing html string (the bullet list of links) and replace it with your own, or you could use php's str_replace to find/replace the string with something else.

    HOWEVER... all that being said (which was really more for readers who come later that think about editing the core), the get_option argument here should actually be changed to 'home'. This is one of those things that is living somewhere deep inside the plugin and hasn't really been addressed because no one else mentioned it as an issue. So I'll be slipping that into the next update.

  4. helirexi
    Member
    Posted 11 months ago #

    Thanks for the detailed answer Chad! You support always amazing!
    I know that is bad (very bad) practice to edit plugin files. I have limited time and make this "dirty hack" (my site online now) I'm very sorry, my bad for poor testing before go online.
    I will study how to use wpmem_register_links the right way :).
    Thanks for you help and direct link!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.