Help using Subscribe2 plugin with Wordpress for Concrete5
Permalink Browser Info Environment
I have Wordpress for Concrete5 installed and I have the Subscribe2 plugin activated to manage email subscriptions to the blog. There is a widget to display the subscribe/unsubscribe form in WP but I'm not sure how to make it show up in c5. If anyone has any ideas on a good way to do this I would really appreciate it.
Type: | Discussion |
---|---|
Status: | New |
I just had the same problem and worked out a rudimentary hack that allows you to include the Subscribe2 signup form into your Concrete5 site. It's a messy hack, and it's not really ready for publication, but I thought it might be of use.
Basically, you need to do three things:
1. Install the block (see attachment)
2. Adjust the block's "view" file - where it says str_replace("/wordpress", "/blog", $content), make sure to replace it with the appropriate file paths. I have installed Wordpress in "/wordpress", but it's accessible on the site through "/blog". Adjust it to how you have arranged this on your site. Otherwise, your visitors will not be able to use the Subscribe2 signup form.
3. Finally, you have to include all of Wordpress to make this work, and you can only do that outside any functions, blocks, or classes (has to do with the scope of global variables). Anyway, I the following code in my "config/site.php" file:
Obviously, adjust the WORDPRESS_CID define to reflect your setup, and adjust the '/blog' and '/wordpress' parts here as well. Hope this helps. Good luck! And let me know if it worked out.
Basically, you need to do three things:
1. Install the block (see attachment)
2. Adjust the block's "view" file - where it says str_replace("/wordpress", "/blog", $content), make sure to replace it with the appropriate file paths. I have installed Wordpress in "/wordpress", but it's accessible on the site through "/blog". Adjust it to how you have arranged this on your site. Otherwise, your visitors will not be able to use the Subscribe2 signup form.
3. Finally, you have to include all of Wordpress to make this work, and you can only do that outside any functions, blocks, or classes (has to do with the scope of global variables). Anyway, I the following code in my "config/site.php" file:
define('WORDPRESS_CID', 110); // Initialize wordpress if we're at the blog page // -- this has to be done here, because it won't work if you initialize it with a // require_once that is (indirectly) called from within a function or class if (intval($_GET["cID"])==WORDPRESS_CID || strpos($_SERVER["REQUEST_URI"], '/blog')!==false) { if (!function_exists('get_option')) { $wordpress = realpath(dirname(__FILE__) . "/../wordpress"); require_once ("$wordpress/wp-blog-header.php"); } }
Obviously, adjust the WORDPRESS_CID define to reflect your setup, and adjust the '/blog' and '/wordpress' parts here as well. Hope this helps. Good luck! And let me know if it worked out.
Elyon, yes this is what I ended up doing. I was not able to get it to check if someone is logged in or not though, so it shows a link to register even if someone is already registered and a link to manage subscription settings even if the user hasn't registered yet. Better than nothing though, at least everything is there.
Edward, thank you for your suggestion- I will let you know how it goes if I try it.
Edward, thank you for your suggestion- I will let you know how it goes if I try it.
There might be a script or two in the header as well, which you would want to copy into the HTML block as well.