Using a “member-only” graphic to brand your posts is a great way to give non-members a “sneek-peek” at the content that is available to them if they become a members.
In the following video, WishList Insider Contributer Betty Walker (the Wise Web Lady) shows you how you can add this feature to your membership website by using the WishList Member API.
As a note, here is the line of code that was added to the archive.php which calls the API function to accomplish this:
<?if(in_array(“Premium”,WLMAPI::GetPostLevels($post->ID)))
{echo “<img border=0 src=’/wp-content/themes/magazine_10/images/member-only.jpg’>”;}?>


Thanks Betty, and after this don’t forget to teach us how to display user gravatar..wink!wink!;)
This is a very important subject. The main reason I joined Insider was to learn how to use the API and other customization functions.
I have a more complex membership/content scenario AND I want most of my content to be discoverable and indexable by Google.
So in my case simply hiding pages or posts doesn’t work.
What I ended up doing was placing my protected content within custom fields, using the API to determine the membership level of the viewer and using custom functions to decide which level of content to display. In this way, every page displays content based on the user level.
This then allowed me to indicate the availability of content to the user based on their logged in status. A green check (and message) if the content is available to the viewer, a yellow check if the content is available to free members (when the free member isn’t logged in) and a red symbol that shows for premium content when user isn’t logged in as a premium member.
You can see this system at work here http://www.byobwebsite.com/video-tutorials/start-building-your-website-here/. This made it much more clear to my members and potential members what was available and what wasn’t.
Thank you for sharing this method.
By making the API available, Wishlist Member has opened the door for developers to increase the functionality in their membership websites and add these kinds of customized features. Thx for sharing, Rick!
Great post Betty!
@Rick – thanks for sharing your tips as well.
We LOVE seeing how everyone is getting creative with WLM.
As a group, you guys will always be WAY more creative than just our team at WLP so the more valuable this membership becomes for everyone
Thx, Stu – glad to hear from you!
Thanks Betty. I ca nsee how this would be of benefit to the members and the owners.
Rick’s explanation gave me more clarity of mind as to why this is important. Thank you all.
Betty thanks for the info. We do not have a membership site yet but this is the kind of information that helps to prepare us for that day.
Take care
Awesome Betty! Well done
Also great to see a fellow Insider as a bonafide contributor.
Betty, dynamite tutorial. You’ve raised the bar for the rest of us…one of the best contributions by a member yet.
Thx, Rick and Steve – good to hear kudos from fellow certified developers!
It would be great if this was a plugin. Plus, the option to change icon by member level. bronze, silver, gold, etc.
Thx for the suggestion of making this a plugin for wishlist, Tony – I will take it under consideration
Thanks for the tutorial Betty. I have people who’ll appreciate this in the future (and I appreciate it now).
Thanks!
Totally agree with Tony. It’s great the the API is available to developers and power users like Betty. But for those of us who just want to run a robust membership site without becoming css and php geeks, this feels like a feature that should just be a part of WLM, or offered as a future bonus plug-in (hint, hint).
[Not to disparage WLM - awesome program. You guys rock!]
Betty, really useful info. I’d appreciate more ‘geek corner’ posts like this, thanks for this.
Wow. This is fabulous information. I’m just now building my wishlist site and I had no idea this was even possible.
Thanks so much for sharing your wisdom!
You are quite welcome, Deb!
Here’s another big THANK YOU to Betty!
I was having a heck of a time using the code on a site I’m building with Headlines. the theme kept breaking every time I inserted the code and I couldn’t figure out why. Everything looked perfect.
Finally I asked Betty for some guidance. She quickly spotted the fact that my code had the wrong style of double quotes as a result of copying and pasting from the post above.
It would have taken me forever to find that one. But thanks to her experience I was off and running.
Ww’re not sure if it was a quirk with my text editor (EditPlus) or operator error. If you’re having similar issues check to make sure your double quotes are straight up and down like this ” and not angled like this ”
What a great resource we have here.
Correction. I had to copy and paste my last post because I wasn’t logged in and I see it caused the second set of quotes to look like the first.
Here’s the correct double quote style ”
Here’s the incorrect ”
Hopefully the formatting will remain the same after I submit. If not, sorry.
Thx, Bob for sharing that with everyone – trying to copy/paste code from a post like this can sometimes be a bit problematic, and PHP is picky about those kinds of things!
In the code example above, is PREMIUM the name of a membership level?
Hi Chris,
Yes, you are correct – Premium is the name of the example membership level, so you would substitute your membership level in the code where Premium shows.
Thanks Betty. This is a very helpful tutorial! I appreciate the quick response too! take care.
Hi all,
Great tip Betty! It would also be useful to wrap this in a function to be placed in your theme’s functions.php file.
Hi, Betty. Thanks for a great tutorial. I found that this may not work if your premium membership plan is set to have access to “All Pages”, “All Posts”, etc in the Membership Levels under the plugin settings.
I created a new post and set the Protection Settings on the post to “No, do not protect this content”. When I published the post, the Premium Content graphic showed up.
I think what happens was that because the Premium users have access to it, it’s calling it premium content even though regular users have access to it, too. I haven’t read the API docs yet so I could be speaking out of turn but I think (in my case, anyway) the code should also check to see (1) that the item is protected and (2) that other membership levels (such as a free level) do NOT have access to it.
If you need any more info about what I ran into, please let me know. In the meantime, I’ll get a copy of the API docs so I understand this better.
Thanks!
Kevin
I was just wondering if a plugin was ever made for this.
This is something we are working on so watch for this in the future
I tried this and I just don’t know what I’m doing. I can usually make minor changes, but I don’t really “know” code.
I’m using a Woothemes called Headlines. Specifically headlines/archive.php … can anybody send me that with the code in the right place? Our member levels are “member, bronze, silver, gold, platinum.”
Also, I thought I read somewhere on this site where our registered users can be “member” .. AND be bronze or silver, or gold, etc. at the same time. The idea being that they’ve joined and paid and are now members. However, after they take quizes we advance them to other levels. Thanks in advance!
Thanks Betty for the tip. I was wondering how that got there.
Where do we get the API docs?
Welcome @JR! Thanks for the comments
You can find the API documentation on the WishList Products site. Here is a direct link:
http://www.wishlistproducts.com/api
I’m happy to announce that my team is about to release the TPress Premium Content Badge plugin – it is only days away from release.
Existing clients of TPress Instant Levels will get an early bird/discounted offer.
Watch http://www.torpedopress.com/wordpressplugins for the big announcement!
Thank you Betty for the info. I too think that this sort of thing should become a plugin if it is possible
I am thrilled with the latest 2.6 release.
Do I need to put this code for each & every members only post or does this take care of all of them?
Thanks Betty
Has anyone been able to get this working on Optimize Press? I’m not able too.
Kind regards
Mandy