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™

List childpages only if custom capability is paid for

s2Member Plugin. A Membership plugin for WordPress®.

List childpages only if custom capability is paid for

Postby webbmalin » December 12th, 2011, 11:47 am

I love you guys, you always help with my problems!
I promise that once my website is done and I'm more experienced I will help others too.

So, I have a custom post type called "kurs". (translates to class)

Every Parent kurs is visible for everybody, this is where the buy button will be.
The kurs will have childpages that are restricted to s2member Level 1 and also a custom capability.

I list the childpages in the sidebar.

I managed to show this sidebar only if you are logged in... BUT...
I want this sidebar (or the childpages) to only be visible if you paid for this custom capability...

And I don't want to write the name of the custom capability in the code, it shouldn't matter what cc is used.

I figured, maybe I should use "is_permitted_by_s2member" in some way, but I couldn't get it to work...

Can anyone help me with this one? :?

Thanks
/Malin
User avatar
webbmalin
Registered User
Registered User
 
Posts: 49
Joined: March 21, 2011

Re: List childpages only if custom capability is paid for

Postby Eduan » December 12th, 2011, 11:51 am

You could check this post:
viewtopic.php?p=56366#p56366

Bruce C shows conditionals but for Custom Capabilites.

Hope this helps. :)
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.

Re: List childpages only if custom capability is paid for

Postby Bruce C » December 12th, 2011, 11:53 am

You need to use the PHP if statement for it:

Code: Select all
<?php
if (current_user_can('access_s2member_ccap_kurs'))
{
//This is where the widget goes
}
?>
~Bruce ( a.k.a. Ace )

If you're interested in a Professional Installation, or Custom Coding Job, you can send your request here.

Proud Supporter of:
The Zeitgeist Movement
and Occupy Everything
User avatar
Bruce C
Experienced User
Experienced User
 
Posts: 337
Joined: July 20, 2011

Re: List childpages only if custom capability is paid for

Postby webbmalin » December 12th, 2011, 12:11 pm

Thanks!

But I do NOT want to write the cc in the code. (kurs is the post type btw, the cc is called "medierna")
I need it to work even if my client adds more custom capablities...

I mean I can show child pages for current page even without writing the page ID... should be possible to show current (or accessable) custom capabilities without writing the name of it... or am I totally out of it ??? :)
User avatar
webbmalin
Registered User
Registered User
 
Posts: 49
Joined: March 21, 2011

Re: List childpages only if custom capability is paid for

Postby Bruce C » December 12th, 2011, 1:15 pm

I'm sure it's possible.

You'd probably have to run a loop through the get_post_meta function to check for the s2member entry, and check to see what custom capabilities is has. I'm not sure how to do it by just talking about it, but I can probably write a code to do this.
~Bruce ( a.k.a. Ace )

If you're interested in a Professional Installation, or Custom Coding Job, you can send your request here.

Proud Supporter of:
The Zeitgeist Movement
and Occupy Everything
User avatar
Bruce C
Experienced User
Experienced User
 
Posts: 337
Joined: July 20, 2011

Re: List childpages only if custom capability is paid for

Postby webbmalin » December 12th, 2011, 1:29 pm

Alright... yeah it's outside my knowledge, haha...
I don't really know php and stuff, only html and learned some wordpress functions that I reuse,,,, but I guess you could tell :)

If you come up with a code that works, you're an angel !!!
User avatar
webbmalin
Registered User
Registered User
 
Posts: 49
Joined: March 21, 2011

Re: List childpages only if custom capability is paid for

Postby Bruce C » December 12th, 2011, 1:33 pm

OK, I'll see if I can throw something together
~Bruce ( a.k.a. Ace )

If you're interested in a Professional Installation, or Custom Coding Job, you can send your request here.

Proud Supporter of:
The Zeitgeist Movement
and Occupy Everything
User avatar
Bruce C
Experienced User
Experienced User
 
Posts: 337
Joined: July 20, 2011

Re: List childpages only if custom capability is paid for

Postby webbmalin » December 19th, 2011, 8:38 am

Hi Bruce!
This is the last thing left on my project :)
I'd really like to get this done, but I just can't figure out how.
I'm realizing this is not a common question, and of course I can pay you for this. Should I send my request using that form on your website, or can we just email each other? malin @ webbmalin.se

Thanks,
Malin
User avatar
webbmalin
Registered User
Registered User
 
Posts: 49
Joined: March 21, 2011

Re: List childpages only if custom capability is paid for

Postby Eduan » December 19th, 2011, 10:51 am

Hi webbmalin,
could you please send a request using that form?
It's our standard way of handling jobs.
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 2 guests

cron