WordPress.org

Ready to get started?Download WordPress

Forums

wp-members and Gallery2 (4 posts)

  1. MelH
    Member
    Posted 7 years ago #

    Hello!

    I've got the wp-members plugin (http://butlerblog.com/wp-members/) and the Gallery2 (http://wpg2.galleryembedded.com/) plugins both installed and working.

    My problem is with putting security on the wp-gallery2.php file.

    All of the other pages in my blog reside in the theme folder. wp-gallery2.php resides at the root.

    I've added the line if (function_exists('wpmem')) { $securify = wpmem(); } to all the pages in my theme, and everybody's happy.

    I added the same line to wp-gallery2.php, and it cannot find the function wpmem (the function_exists check fails).

    I thought I'd have two solutions:

    1. move wp-gallery2.php to the themes folder
    2. somehow get the wp-gallery2.php file to see the wpmem function.

    ...but I'm not sure how to safely accomplish either...

    any suggestions?

    thanks!
    Mel

  2. Have you tried the WPG2 forums for this?

  3. Chad Butler
    Member
    Posted 7 years ago #

    Mel,

    Sorry it took me so long to get to this. I've been slammed with some commercial projects lately. Also, not being a user of G2, I had to install it and work with it to understand the issue. (I did find that I really like G2, so that turned out well.)

    Having gotten over that hurdle, I have a better understanding of the issue, so I'll see if I can get this fixed for you.

  4. Chad Butler
    Member
    Posted 7 years ago #

    Basically, the problem is this: in the wp-gallery2.php file, you have to wait until the wp-config.php is required. If you go right below the line that says:

    require('./wp-config.php');

    and after that add:

    if (function_exists('wpmem')) { $securify = wpmem(); }

    The plugins should be available at that point and you can load the $securify value. Then you have figure out where the page output is done and needs to be restricted. In my quick and dirty look at this (and I'm using the kubrick theme - a different theme and pretty output, might need some tweaking here), I went down to the line that says:

    echo $g2data['bodyHtml']; //Display the gallery content

    This would be where the body output is handled. We want to protect that. So right BEFORE that I added:

    if ( ($securify != "false") || (!function_exists('wpmem')) ) {
    if (function_exists('wpmem')) { wpmem_status($securify);}
    if ( ($securify == "true") || (!function_exists('wpmem')) ) {

    AND BELOW it, I closed up my if statements with:

    }
    }

    That should do it. Like I said, quick and dirty. You might have to play around to make it pretty. Mel - I'll send you an email with this as well, and if you have additional problems w/ it, let me know.

Topic Closed

This topic has been closed to new replies.

About this Topic