latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

s2 user registration -> Default Role's

Home Forums Community Forum s2 user registration -> Default Role's

This topic contains 5 replies, has 2 voices. Last updated by  Cristián Lávaque 4 years, 5 months ago.

Topic Author Topic
Posted: Monday Jul 2nd, 2012 at 3:24 pm #18104

I have recently purchased your s2 member pro, installed and configured it. The registration process works, the paypal check out works. But I am having trouble creating roles that work for the users of the site.

Scenario: User checks out using the s2 member checkout process. They are assigned to the S2 membership level s2#4. They login into the site. They are able to create posts and use the buddy press portion of the site.

PROBLEM: After the s2 registered users have created posts and other content in buddy press, they do not appear as an author in the WP admin area. Since they are not regulated/assigned by the standard WordPress users levels, I am unable to reassign exisiting posts to thier user profile. Additionally only users that have been registered through the standard registration process are visible as content authors.

I am migrating existing content into this new system. Additionally I am using other plugins that have unique user types/roles that will not function with s2 unless there is a way for s2 to extend access or inherit those roles aswell.

Please let me know how to extend S2 member levels to existing user roles, eg(Author, Editor, Subscriber) or if there is a work around or fix for this.

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Tuesday Jul 3rd, 2012 at 7:04 am #18163

Hi Nathan.

I know of a hack Jason once posted to change the default role someone gets on registration, but it’s not for paid roles. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2760

I’ll email Jason asking if it’s possible to change the roles used for paid users.

Posted: Wednesday Jul 4th, 2012 at 12:20 am #18238

I got a reply from him with this hack to use in /wp-content/mu-plugins/s2hacks.php

[hilite pre_code]
set_role($custom_role);
}
[/hilite]

Conditionals could be applied to map levels or roles that s2Member uses by default, to custom roles setup by a site owner.

I hope that helps. :)

Posted: Thursday Jul 12th, 2012 at 4:32 pm #19074

This is interesting. Thank you. Here is the main concern. I have been adding all of the site content for the base users of the site. But if there role is assigned to s2member roll then they do not show up in the author box to assign the ownership of the site. If i switch the user to author or any default WP role they show up in the Author Box. Switching them would be fine, except for the fact that S2member redirects only seem to work for custom S2member rolls. I have tried assigning the capabilties of Author role to the s2member, and even inheriting the s2member roles for the author, but neither of these methods functions correctly.

Please let me know if there is any futher information to help me find a solutions.

Posted: Thursday Jul 12th, 2012 at 5:41 pm #19082

Found a great solution

Inside of mu-plugins/s2hacks.php

I add this

// Added to extend to the Author role capabilities to s2 member default roles
add_role( ‘s2member_level2’, ‘S2 Member Level 2’);
$author = get_role(‘author’);
$s2member_level2 = get_role(‘s2member_level2’);
if($admin->capabilities){
foreach($author->capabilities as $cap => $bool){
if($bool){
$s2member_level2->add_cap($cap);
}
}
}

Posted: Friday Jul 13th, 2012 at 7:11 am #19155

Thanks for sharing that, Nathan.

Here it is inside code tags:

[hilite pre_code]
// Added to extend to the Author role capabilities to s2 member default roles
add_role('s2member_level2', 'S2 Member Level 2');
$author = get_role('author');
$s2member_level2 = get_role('s2member_level2');
if ($admin->capabilities){
foreach ($author->capabilities as $cap => $bool) {
if ($bool)
$s2member_level2->add_cap($cap);
}
}
[/hilite]

So you add the Author role’s capabilities to the s2Member Level 2 role, right? And you use the hack once and then remove it?

But why are you creating the s2member_level2 with [hilite mono]add_role[/hilite] if the role already exists?

Viewing 5 replies - 1 through 5 (of 5 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.