PriMoThemes — now s2Member® (official notice)
This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™
No, these pages would need to be created manually. However, a good developer can bypass this with something more automated. For instance, you might do something like this.1) One thing I wasn't clear on (sorry if its a dumb question!) are the username pages (eg. maryjane) set up automatically upon user sign up? I assume it's not a manual input job?
<?php
add_action("init", "portal_rewrites");
function portal_rewrites()
{
add_rewrite_rule("(portal-for)/(.+)$", 'index.php?pagename=$matches[1]&username=$matches[2]', "top");
add_rewrite_tag("%username%", "(.+?)");
}
?>
This looks good. I think s2Member is a great fit for this. I'd stick with it. You might also seek assistance from a freelancer that is familiar with WordPress and/or s2Member both.2) The result I would like the achieve is a fairly detailed one and I have attached a screenshot of what I'm trying to replicate. Just wondered what your opinion is of this being achievable with S2 or if I will have to look for a custom solution?
Many thanks for the excellent support!
Jason Caldwell wrote:3. In your theme, create a page that handles the /portal-for/[username] page, and get this query var.
<?php $username = get_query_var("username"); ?>
This way you don't' need to create a page for each user, you just need a template file that reads in the $username value and dynamically displays what it needs to, for the current user.
Jason Caldwell wrote:No, these pages would need to be created manually. However, a good developer can bypass this with something more automated. For instance, you might do something like this.1) One thing I wasn't clear on (sorry if its a dumb question!) are the username pages (eg. maryjane) set up automatically upon user sign up? I assume it's not a manual input job?
1. Login Redirection URL:
http://www.example.com/portal-for/%%current_user_login%%/
2. Create MUST USE plugin, /wp-content/mu-plugins/portal-rewrites.php* Go back to Permalink settings in WordPress and click "save" so this propagates.
- Code: Select all
<?php
add_action("init", "portal_rewrites");
function portal_rewrites()
{
add_rewrite_rule("(portal-for)/(.+)$", 'index.php?pagename=$matches[1]&username=$matches[2]', "top");
add_rewrite_tag("%username%", "(.+?)");
}
?>
Reference article: http://codex.wordpress.org/Class_Reference/WP_Rewrite
3. In your theme, create a page that handles the /portal-for/[username] page, and get this query var.
<?php $username = get_query_var("username"); ?>
This way you don't' need to create a page for each user, you just need a template file that reads in the $username value and dynamically displays what it needs to, for the current user.This looks good. I think s2Member is a great fit for this. I'd stick with it. You might also seek assistance from a freelancer that is familiar with WordPress and/or s2Member both.2) The result I would like the achieve is a fairly detailed one and I have attached a screenshot of what I'm trying to replicate. Just wondered what your opinion is of this being achievable with S2 or if I will have to look for a custom solution?
Many thanks for the excellent support!s2Member® / Hot Tip: ( s2Installs.com! )
Recommended by s2Member® Lead Developer (Jason Caldwell). Their rate for a standard installation is $125. They're highly trained. Just request their service!Need Help? Post A New Job!
It's free. Your Job will appear here, and @ jobs.wordpress.net. It will be displayed for a period of 21 days; or until you take it off, whichever comes first. Good luck!
Cristián Lávaque wrote:Jason Caldwell wrote:3. In your theme, create a page that handles the /portal-for/[username] page, and get this query var.
<?php $username = get_query_var("username"); ?>
This way you don't' need to create a page for each user, you just need a template file that reads in the $username value and dynamically displays what it needs to, for the current user.
You're suggesting not to create a page for each user then, protected with a custom capability for each page/user. Right?
This same thing can already be done with the Login Welcome page not using hack, just conditionals in the page. WP Admin -> s2Member -> API / Scripting -> Advanced/PHP Conditionals
The URL won't be customized to the user, though. You could add the username in the querystring... not as clean, but would work: http://www.example.com/portal-for/?%%current_user_login%%
That username in the URL would just be for looks, in the page you'd use S2MEMBER_CURRENT_USER_LOGIN. WP Admin -> s2Member -> API / Scripting -> s2Member PHP/API Constants -> S2MEMBER_CURRENT_USER_LOGIN
Right, just for looks mostly, or organization perhaps. You're right though, there's definitely more than 10 ways to skin this cat. A query string, or even just a "handle-all" Page would do fine, as long as it has internal conditional checks against the current User.Cristian wrote:That username in the URL would just be for looks, in the page you'd use S2MEMBER_CURRENT_USER_LOGIN. WP Admin -> s2Member -> API / Scripting -> s2Member PHP/API Constants -> S2MEMBER_CURRENT_USER_LOGIN
<?php
$user = wp_get_current_user();
if($user->has_cap("access_s2member_ccap_maryjane"))
echo 'This page is for Mary Jane';
?>
Jason Caldwell wrote:Thanks for the follow-up.
Sorry, no. There's no Shortcode for that yet.
Here's a way to achieve what you need via PHP though.
Create this directory and file:
/wp-content/mu-plugins/s2-list-ccap-files.php
( these are MUST USE plugins, see: http://codex.wordpress.org/Must_Use_Plugins )
- Code: Select all
<?php
function s2_list_ccap_files ($ccap)
{
if ($ccap && is_string ($ccap) && is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
if (is_dir ($ccap_dir = $files_dir . "/access-s2member-ccap-" . $ccap) && is_readable ($ccap_dir))
{
foreach (scandir ($ccap_dir) as $file)
{
if (strpos ($file, ".") !== 0)
{
$files[] = $file;
}
}
}
return (!empty ($files) && is_array ($files)) ? implode ("<br />", $files) : "";
}
?>
Now install this PHP Execution plugin, very simple. So you can do this inside a Post/Page.
- Code: Select all
<?php echo s2_list_ccap_files("maryjane"); ?>
If you get PHP header errors, you have extra spaces/tabs/line breaks before or after <?php ?>.
Unzip the attached file to get the original, and upload it to:
/wp-content/mu-plugins/s2-list-ccap-files.php
Cristián Lávaque wrote:Hi Kitty. You may want to check out custom capabilities in combination with download protection. WP Admin -> s2Member -> API / Scripting -> Custom Capability & Member Level Files
I hope that helps.
Cristián Lávaque wrote:That's a file uploader that is not part of s2Member, so you'll need to customize it to integrate with s2Member's file protection. First learn how to protect files with s2Member without that uploader, so you learn it well, then you'll know what the uploader would need to do so the files are protected.
Jason created a video explaining download protection, but new features were added since, so I recommend you read all the documentation on it too.
http://www.s2member.com/file-download-options-video/
WP Admin -> s2Member -> Downloads Options
WP Admin -> s2Member -> API / Scripting -> Custom Capability & Member Level Files
I hope that helps.
Return to Common Questions/Problems/Tips
Users browsing this forum: No registered users and 0 guests