• Resolved mywebmaestro

    (@mywebmaestro)


    I’m trying to use the following in a file located outside of the WordPress installation but that calls WordPress using: require(‘../../wp-blog-header.php’);

    The page in question is mostly HTML, which I first put into $content and then use with the shortcode like this:

    print do_shortcode(‘[pms-restrict subscription_plans=”1147″]’ . $content . ‘[/pms-restrict]’);

    However, it looks like the PMS functions aren’t connecting with the login functions of WordPress this way, though I am able to see that the WordPress core is loading. Is there a way to make this work in this fashion, or is there a better way to control access to non-WordPress content connected to subscriptions?

    (The website in particular that I’m working on is selling access to stand alone educational courses that are served via HTML5/Flash in folders outside the WordPress installation.)

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Georgian Cocora

    (@raster02)

    Hello @mywebmaestro,

    Can you tell me what happens exactly when you do that ?
    Does it just show the whole thing with the [pms-restrict] shortcode also ?

    Regards,

    Thread Starter mywebmaestro

    (@mywebmaestro)

    At first I tried using PHP to include the opening shortcode before and the closing one after the regular HTML content of the page, but it shows the HTML either way when I do that. So, I tried putting the HTML into the variable you see in my example above. However, it doesn’t display the shortcode on the screen, it seems able to recognize that it’s a shortcode, but it’s not connecting with the login – I’m not sure I’m describing this very well. :-/ It just looks like it’s not able to connect with whatever part of the plugin is checking for login status.

    Thread Starter mywebmaestro

    (@mywebmaestro)

    Correction… sorry, I’d forgotten that I’d played with this some more last night. You can see the result here: https://respectfulways.com/course/test/

    The code on that page is:

    <?php require '../../testing/wp-blog-header.php';
    status_header(200);
    nocache_headers();
    ?>
    
    <html>
        <head>
            <?php wp_head(); ?>
        </head>
        <body>
            
    <? $content = "<h1>Hello World</h1>"; ?>
       
    <?php echo do_shortcode('[pms-restrict subscription_plans="6"]' . $content . '[/pms-restrict]'); ?>
    
    <?php echo do_shortcode('[pms-login]'); ?>
            
            <?php wp_footer(); ?>
         </body>
    </html>

    I created a plan login if you want to try…
    username: Testing
    password: rK6mX0waW8x

    anonymized-12966443

    (@anonymized-12966443)

    @mywebmaestro, don’t share credentials no matter it’s a test.

    Thread Starter mywebmaestro

    (@mywebmaestro)

    I know, but it’s only the very limited role. (And the site here won’t let me edit the response.) :-/

    Plugin Author Georgian Cocora

    (@raster02)

    Hey,

    Can you make this snippet load and see if it works afterwards:

    add_filter('pms_get_current_page_url', 'pmsc_remove_port');
    function pmsc_remove_port($url) {
    	return str_replace(':443, '', $url);
    }

    Should load if you add it as a plugin.

    The port seems to be added to the redirect_url and this makes the login not work.

    Regards.

    Thread Starter mywebmaestro

    (@mywebmaestro)

    Adding it to the functions.php file would be the same, correct? That’s what I’ve tried and it doesn’t seem to affect the result at all. (I had to add a ‘ though after the 443)

    Plugin Author Georgian Cocora

    (@raster02)

    Hello,

    Did you specify a redirect_url to the pms-login shortcode ? If not, can you do this and give it another try ?

    If that doesn’t help, give it a try with the login form from Theme My Login.

    Regards.

    Thread Starter mywebmaestro

    (@mywebmaestro)

    I tried including the pms login shortcode on that same external page and it shows the login form. But I’m not sure how the redirect you describe should be set up – do you mean that the index page of the external content should redirect to a page within wordpress?

    Plugin Author Georgian Cocora

    (@raster02)

    Hey,

    No. I meant that you should try to use the redirect_url for our shortcode: https://www.cozmoslabs.com/docs/paid-member-subscriptions/shortcodes/#Redirect_User_after_Login

    Regards.

    Thread Starter mywebmaestro

    (@mywebmaestro)

    Ok, I think I see, however I think a part of the problem is that WordPress isn’t recognizing log-in status at all with this method of bringing WordPress into the external content. I think it’s grabbing much of the functioning parts, but not all. (Which wouldn’t be a problem with the plugin, but rather the method of interacting with WordPress, if I understand correctly.)

    Plugin Author Georgian Cocora

    (@raster02)

    I can’t test this directly but the issue seems to be that the https port is added to the redirect url when you return back to your page.

    Did you try the login form from the Theme My Login plugin ? We create our form using WordPress functions but they have a custom implementation that doesn’t rely on wp-login.php. Give it a try.

    I don’t have any other ideas about this.

    Regards.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Content External to WordPress’ is closed to new replies.