Convert [current_user_ccaps] result to links?

Hi,

The %%current_user_ccaps%% tag shows a hyphenated list of the capabilities of a specific user.

Is there a way, probably via a php loop and an array, to convert the resulting hyphenated list to a series of links ?

Miles.

Possible, please show me an example list, and also the URLs of each link and I will create the code.

I’m trying to produce one, but it will take a bit…I only just found out about the list.

Thank you for the offer to support this feature…

I’ll be right back to you…

Krumch,

Found it.

If you go to your user list, and then select any user, and then edit the user, down at the bottom of the page you’ll see a whole bunch of S2Member entries -> the ability to add user custom capabilities is the 6th one down under S2Member title. If you add a CCAP to any one of your users and then update the page, you’ll see the list. I went looking in the source code how this list was generated and I couldn’t find the damned thing.

Perhaps you’ll have better luck than I did.

Thanks, can see. But what are the links you want to create? Where they are pointed to? How they are related to ccaps of the user?

Also, where you need them, in which environment?

Let’s try this:

if ccap says “CAP1” should point to “URL1”
if ccap says “CAP2” should point to “URL2”
if ccap says “CAP3” should point to “URL3”
etc…

where CAPx = sometext value
where URL = http://www.mydomain.com/page-entervalue

rather than create a series of nesting S2IF statements, the code should dynamically match CAP = URL, and then show the resulting list of links in a vertical list like so:

You have purchased these capabilities:

http://www.mydomain.com/page-entervalue1
http://www.mydomain.com/page-entervalue2
http://www.mydomain.com/page-entervalue3

etc.

Miles.

This needs a custom plugin to map each ccap to need URL. I can do for you, but easer is do with [s2If].

Why do people need to do things the hard way ?

If I wanted to write a bunch of conditional if statements I’d end up with quite literally hundreds of them on a page. Not an option. We have a dynamic data driven tool. The data is stored somewhere, how hard is it to look either do one of two things.

1.) read a data table and pull the resulting solutions. OR
2.) write a tool that will allow for input your own and then output those solutions.

There is a 3rd option, and that’s to merge both ideas.

I’ll write the damned thing myself…oy. :wink:

Miles.

I see no way for script to know what URL must produce each ccap, as your ccaps are not related to resulting URLs by any way… But seems I miss something.

There is a way for it to be done, on a page update.
Actually I’m sort of surprised that S2Member doesn’t do this by default. It’s one maybe two extra values that they already use…why wasn’t this done in development … It’s an easy fix.
The hard part, you’re right is going through and getting them all, however…that’s a one time run. What could easily happen is that either when the code is run the first time, it would update ALL post and page records OR as page is touched in someway, it would auto update. The more efficient way is the 1st.
It’s doable though. This isn’t rocket science.
Miles.

I still have no idea where the info about the URLs will come from (where they will be pointed?), but maybe we use different terms thus I can not understand. As you will do it, and s2M free version is open source, you can share your solution and ask authors to merge it, for benefit of everyone.